Search code examples
angularnetlify

having issue deploying angular app on netlify


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/[email protected]
9:41:29 PM: npm ERR! Found: @angular/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
9:41:29 PM: npm ERR! node_modules/@angular/compiler
9:41:29 PM: npm ERR!   peer @angular/compiler@"14.2.6" from @angular/[email protected]
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/[email protected]
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


Solution

  • 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?