skip to Main Content

I have an Angular 10 application that I tried to update and make it use Angular 16. I followed the Angular Update Guide page and went up, one version at a time. It all went smooth until I tried moving from Angular 15 to Angular 16. Now, when I execute the "ng version" command in my Visual Studio Code terminal, I see this:

Angular CLI: 16.2.14
Node: 16.20.2
Package Manager: npm 8.19.4
OS: win32 x64

Angular: <error>
... animations, cdk, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1602.14 (cli-only)
@angular-devkit/build-angular   <error>
@angular-devkit/core            16.2.14 (cli-only)
@angular-devkit/schematics      16.2.14 (cli-only)
@angular/cli                    16.2.14 (cli-only)
@schematics/angular             16.2.14 (cli-only)
rxjs                            7.8.1 (cli-only)
typescript                      <error>
zone.js                         <error>

Why are there so many errors listed?

The "ng build" command generates this quick error:

Error: Could not find the '@angular-devkit/build-angular:browser' builder's node package.

Running "npm install" generates this error, after it goes through the process for a while:

npm ERR! code 1
npm ERR! path C:ProjectsDevSystemsMMWASourceUITabletApptablet-appnode_modulesesbuild
npm ERR! command failed
npm ERR! command C:windowssystem32cmd.exe /d /s /c node install.js
npm ERR! node:internal/errors:857
npm ERR!   const err = new Error(message);
npm ERR!               ^
npm ERR!
npm ERR! Error: Command failed: C:Program Filesnodejsnode.exe C:ProjectsDevSystemsMMWASourceUITabletApptablet-appnode_modulesesbuildbinesbuild --version
npm ERR! node:child_process:899
npm ERR!     throw err;
npm ERR!     ^
npm ERR!
npm ERR! <ref *1> Error: spawnSync C:ProjectsDevSystemsMMWASourceUITabletApptablet-appnode_modules@esbuildwin32-x64esbuild.exe UNKNOWN
npm ERR!     at Object.spawnSync (node:internal/child_process:1119:20)
npm ERR!     at spawnSync (node:child_process:847:24)
npm ERR!     at Object.execFileSync (node:child_process:890:15)
npm ERR!     at Object.<anonymous> (C:ProjectsDevSystemsMMWASourceUITabletApptablet-appnode_modulesesbuildbinesbuild:220:28)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1198:14)
npm ERR!     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:1076:32)
npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:911:12)
npm ERR!     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
npm ERR!     at node:internal/main/run_main_module:22:47 {
npm ERR!   errno: -4094,
npm ERR!   code: 'UNKNOWN',
npm ERR!   syscall: 'spawnSync C:\Projects\DevSystems\MMWA\Source\UI\TabletApp\tablet-app\node_modules\@esbuild\win32-x64\esbuild.exe',
npm ERR!   path: 'C:\Projects\DevSystems\MMWA\Source\UI\TabletApp\tablet-app\node_modules\@esbuild\win32-x64\esbuild.exe',
npm ERR!   spawnargs: [ '--version' ],
npm ERR!   error: [Circular *1],
npm ERR!   status: null,
npm ERR!   signal: null,
npm ERR!   output: null,
npm ERR!   pid: 0,
npm ERR!   stdout: null,
npm ERR!   stderr: null
npm ERR! }
npm ERR!
npm ERR!     at checkExecSyncError (node:child_process:861:11)
npm ERR!     at Object.execFileSync (node:child_process:896:15)
npm ERR!     at validateBinaryVersion (C:ProjectsDevSystemsMMWASourceUITabletApptablet-appnode_modulesesbuildinstall.js:98:28)
npm ERR!     at C:ProjectsDevSystemsMMWASourceUITabletApptablet-appnode_modulesesbuildinstall.js:283:5 {
npm ERR!   status: 1,
npm ERR!   signal: null,
npm ERR!   output: [
npm ERR!     null,
npm ERR!     Buffer(0) [Uint8Array] [],
npm ERR!     Buffer(1377) [Uint8Array] [
npm ERR!       110, 111, 100, 101,  58,  99, 104, 105, 108, 100,  95, 112,
npm ERR!       114, 111,  99, 101, 115, 115,  58,  56,  57,  57,  13,  10,
npm ERR!        32,  32,  32,  32, 116, 104, 114, 111, 119,  32, 101, 114,
npm ERR!        10,  60, 114, 101, 102,  32,  42,  49,  62,  32,  69, 114,
PS C:ProjectsDevSystemsMMWASourceUITabletApptablet-app> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @angular-devkit/[email protected]
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR!   dev @angular-devkit/build-angular@"^16.2.14" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev @angular-devkit/build-angular@"^16.2.14" from the root project  
npm ERR!
npm ERR! Conflicting peer dependency: @angular/[email protected]
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   peer @angular/compiler-cli@"^16.0.0" from @angular-devkit/[email protected]     
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/build-angular@"^16.2.14" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:UserselAppDataLocalnpm-cacheeresolve-report.txt for a full report.    

npm ERR! A complete log of this run can be found in:
npm ERR!     C:UserselAppDataLocalnpm-cache_logs2024-05-01T00_37_05_023Z-debug-0.log

Any thoughts?
Ed

2

Answers


  1. From what I can see from your npm error, you seems to have a discrepancy with the installed version of angular-devkit/build-angular which is still in version 15.

    I’d suggest running the following command

    ng update @angular-devkit/build-angular@16
    

    And then check for any more errors.

    Login or Signup to reply.
  2. I have encountered this error before, try to follow one of these steps:

    1- Reinstall Dependencies:

    remove ‘node_modules’ directory and reinstalling dependencies by running:

    npm install
    

    2- Update Angular CLI:

    If you’ve recently updated your Angular version, ensure that you’ve updated Angular CLI as well by running:

    npm install -g @angular/cli
    

    3- Verify @angular-devkit/build-angular:

    ensure that the @angular-devkit/build-angular package is listed as a dependency in package.json file. If it’s missing, you can add it manually by running:

    npm install @angular-devkit/build-angular --save
    

    4- Clear Cache:

    Sometimes, caching issues can cause this problem, use this command:

    npm cache clean --force
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search