We couldn’t deploy your site - Build failed after ng add @angular/pwa

Hello,

Can someone please help me as my build kept failing. The below error occurred after I run ng add @angular/pwa , did ng build after everything(pwa configuration) and now seems I am not able to deploy to netlify successful. Any help would be appreciated.

site name: https://appdesigns.netlify.app/

Logs below:

8:33:43 PM: Build ready to start

8:33:44 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)

8:33:44 PM: build-image tag: v4.10.1

8:33:44 PM: buildbot version: 2009834004fbab70d95494495d61f0ada38da28b

8:33:45 PM: Fetching cached dependencies

8:33:45 PM: Starting to download cache of 380.5MB

8:33:49 PM: Finished downloading cache in 4.674825252s

8:33:49 PM: Starting to extract cache

8:33:53 PM: Finished extracting cache in 3.285589159s

8:33:53 PM: Finished fetching cache in 8.051471983s

8:33:53 PM: Starting to prepare the repo for build

8:33:53 PM: Preparing Git Reference refs/heads/main

8:34:04 PM: Parsing package.json dependencies

8:34:05 PM: Starting build script

8:34:05 PM: Installing dependencies

8:34:05 PM: Python version set to 2.7

8:34:06 PM: Started restoring cached node version

8:34:08 PM: Finished restoring cached node version

8:34:08 PM: v16.16.0 is already installed.

8:34:09 PM: Now using node v16.16.0 (npm v8.11.0)

8:34:09 PM: Started restoring cached build plugins

8:34:09 PM: Finished restoring cached build plugins

8:34:09 PM: Attempting ruby version 2.7.2, read from environment

8:34:10 PM: Using ruby version 2.7.2

8:34:10 PM: Using PHP version 8.0

8:34:10 PM: No npm workspaces detected

8:34:10 PM: Started restoring cached node modules

8:34:10 PM: Finished restoring cached node modules

8:34:10 PM: Installing NPM modules using NPM version 8.11.0

8:34:11 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special

8:34:11 PM: npm WARN config location in the cache, and they are managed by

8:34:11 PM: npm WARN config cacache.

8:34:11 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special

8:34:11 PM: npm WARN config location in the cache, and they are managed by

8:34:11 PM: npm WARN config cacache.

8:34:14 PM: npm ERR! code ERESOLVE

8:34:14 PM: npm ERR! ERESOLVE could not resolve

8:34:14 PM: npm ERR!

8:34:14 PM: npm ERR! While resolving: @angular-devkit/build-angular@14.1.1

8:34:14 PM: npm ERR! Found: @angular/compiler-cli@14.2.0-next.0

8:34:14 PM: npm ERR! node_modules/@angular/compiler-cli

8:34:14 PM: npm ERR! dev @angular/compiler-cli@“^14.2.0-next.0” from the root project

8:34:14 PM: npm ERR!

8:34:14 PM: npm ERR! Could not resolve dependency:

8:34:14 PM: npm ERR! peer @angular/compiler-cli@“^14.0.0” from @angular-devkit/build-angular@14.1.1

8:34:14 PM: npm ERR! node_modules/@angular-devkit/build-angular

8:34:14 PM: npm ERR! dev @angular-devkit/build-angular@“^14.1.1” from the root project

8:34:14 PM: npm ERR!

8:34:14 PM: npm ERR! Conflicting peer dependency: @angular/compiler-cli@14.1.1

8:34:14 PM: npm ERR! node_modules/@angular/compiler-cli

8:34:14 PM: npm ERR! peer @angular/compiler-cli@“^14.0.0” from @angular-devkit/build-angular@14.1.1

8:34:14 PM: npm ERR! node_modules/@angular-devkit/build-angular

8:34:14 PM: npm ERR! dev @angular-devkit/build-angular@“^14.1.1” from the root project

8:34:14 PM: npm ERR!

8:34:14 PM: npm ERR! Fix the upstream dependency conflict, or retry

8:34:14 PM: npm ERR! this command with --force, or --legacy-peer-deps

8:34:14 PM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

8:34:14 PM: npm ERR!

8:34:14 PM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.

8:34:14 PM: npm ERR! A complete log of this run can be found in:

8:34:14 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-08-10T00_34_11_465Z-debug-0.log

8:34:14 PM: Error during NPM install

8:34:14 PM: Build was terminated: Build script returned non-zero exit code: 1

8:34:14 PM: Creating deploy upload records

8:34:14 PM: Failing build: Failed to build site

8:34:14 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1 (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)

8:34:14 PM: Finished processing build request in 29.935961965s

I have tried below, yet not working, not able to deploy site as it keeps failing: Wondering if this could be from netlify or mycode.

rm package-lock.json
rm -rf node_modules
npm install
ng update 
npm install --save  --legacy-peer-deps

Solution:

I was able to solve the problem by removing below:

@angular/http@8.0.0-beta.10

from package.json file

1 Like

Hey there, @appdesigns :wave:

Thanks for coming back and sharing your solution! This will help future members who encounter the same error. Happy building :rocket:

1 Like