0

i'm having issues deploying my angular app to netlify, the app is working perfectly on my local host but when i deploy i get the following err can anyone help out

9:41:28 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
9:41:29 PM: npm ERR! code ERESOLVE
9:41:29 PM: npm ERR! ERESOLVE could not resolve
9:41:29 PM: npm ERR!
9:41:29 PM: npm ERR! While resolving: @angular/compiler-cli@14.2.6
9:41:29 PM: npm ERR! Found: @angular/compiler@14.0.3
9:41:29 PM: npm ERR! node_modules/@angular/compiler
9:41:29 PM: npm ERR!   @angular/compiler@"^14.0.2" from the root project
9:41:29 PM: npm ERR!   peer @angular/compiler@"14.0.3" from @angular/platform-browser-dynamic@14.0.3
9:41:29 PM: npm ERR!   node_modules/@angular/platform-browser-dynamic
9:41:29 PM: npm ERR!     @angular/platform-browser-dynamic@"^14.0.2" from the root project
9:41:29 PM: npm ERR!
9:41:29 PM: npm ERR! Could not resolve dependency:
9:41:29 PM: npm ERR! peer @angular/compiler@"14.2.6" from @angular/compiler-cli@14.2.6
9:41:29 PM: npm ERR! node_modules/@angular/compiler-cli
9:41:29 PM: npm ERR!   @angular/compiler-cli@"^14.0.2" from the root project
9:41:29 PM: npm ERR!   peer @angular/compiler-cli@"^14.0.0" from @angular-devkit/build-angular@14.0.3
9:41:29 PM: npm ERR!   node_modules/@angular-devkit/build-angular
9:41:29 PM: npm ERR!     dev @angular-devkit/build-angular@"~14.0.3" from the root project
9:41:29 PM: npm ERR!   2 more (@angular/localize, @ngtools/webpack)
9:41:29 PM: npm ERR!
9:41:29 PM: npm ERR! Conflicting peer dependency: @angular/compiler@14.2.6
9:41:29 PM: npm ERR! node_modules/@angular/compiler
9:41:29 PM: npm ERR!   peer @angular/compiler@"14.2.6" from @angular/compiler-cli@14.2.6
9:41:29 PM: npm ERR!   node_modules/@angular/compiler-cli
9:41:29 PM: npm ERR!     @angular/compiler-cli@"^14.0.2" from the root project
9:41:29 PM: npm ERR!     peer @angular/compiler-cli@"^14.0.0" from @angular-devkit/build-angular@14.0.3
9:41:29 PM: npm ERR!     node_modules/@angular-devkit/build-angular
9:41:29 PM: npm ERR!       dev @angular-devkit/build-angular@"~14.0.3" from the root project
9:41:29 PM: npm ERR!
9:41:29 PM: Build was terminated: Build script returned non-zero exit code: 1
9:41:29 PM: Creating deploy upload records
9:41:29 PM: Failing build: Failed to build site
Top comments (0)



enter image description here enter image description here

Tosin Ayoola
  • 77
  • 1
  • 9

2 Answers2

1

One possible solution is to use a .npmrc file to specify options during the install.

If you haven't already, add a .npmrc file to the project root with the following content:

legacy-peer-deps=true

For more information on what this option does, see: What does npm install --legacy-peer-deps do exactly? When is it recommended / What's a potential use case?

Brandon Taylor
  • 33,823
  • 15
  • 104
  • 144
  • the deployment was successful, but when i click on the app link https://jobkonnect.netlify.app/, i'm getting a 404 error – Tosin Ayoola Nov 05 '22 at 10:38
0

The npm install command fails. clean your package.json or try npm install --force

to clean your package.json set the same angular version to all your angular libraries.

cy.
  • 1
  • 2
  • this is on netlify oh, not on my localhost – Tosin Ayoola Oct 16 '22 at 20:21
  • in the build & deploy setting you can change the command line done by netlify. But if you clear your package.json it will works. to clean, remove your node_modules folder 'rm -rf node_modules' and try reinstall with the same command line you found on netlify build setting – cy. Oct 17 '22 at 00:06
  • am i clearing the package.json file on my device or that on netlify ? – Tosin Ayoola Oct 17 '22 at 12:41
  • on your device. (it's work on your device but maybe you use --force to install package so you need to have a clear package.json) just change the Librairies with angular in it at version 14.2.6 first – cy. Oct 17 '22 at 12:47
  • i've done that, but it still same err, i tried updating to lastest version, but it says everytin seems good – Tosin Ayoola Oct 17 '22 at 22:15
  • can you share your package.json? – cy. Oct 18 '22 at 21:20
  • i've added a screenshot of it to the initial post – Tosin Ayoola Oct 19 '22 at 14:39
  • in text to copy it – cy. Oct 20 '22 at 14:24