Issue
I have got a problem while updating my angular project from version 15 to 16. When I try to update it, I always get the following error:
npm ERR! path C:\Users\WebContent\node_modules\esbuild
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node install.js
npm ERR! node:internal/errors:865
npm ERR! const err = new Error(message);
npm ERR! ^
npm ERR!
npm ERR! Error: Command failed: C:\Program Files\nodejs\node.exe C:\Users\WebContent\node_modules\esbuild\bin\esbuild --version
npm ERR! node:child_process:929
npm ERR! throw err;
npm ERR! ^
npm ERR!
npm ERR! <ref *1> Error: spawnSync C:\Users\WebContent\node_modules\@esbuild\win32-x64\esbuild.exe UNKNOWN
npm ERR! at Object.spawnSync (node:internal/child_process:1117:20)
npm ERR! at spawnSync (node:child_process:876:24)
npm ERR! at Object.execFileSync (node:child_process:919:15)
npm ERR! at Object.<anonymous> (C:\Users\WebContent\node_modules\esbuild\bin\esbuild:220:28)
npm ERR! at Module._compile (node:internal/modules/cjs/loader:1256:14)
npm ERR! at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
npm ERR! at Module.load (node:internal/modules/cjs/loader:1119:32)
npm ERR! at Module._load (node:internal/modules/cjs/loader:960:12)
npm ERR! at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
npm ERR! at node:internal/main/run_main_module:23:47 {
npm ERR! errno: -4094,
npm ERR! code: 'UNKNOWN',
npm ERR! syscall: 'spawnSync C:\\Users\\WebContent\\node_modules\\@esbuild\\win32-x64\\esbuild.exe',
npm ERR! path: 'C:\\Users\\WebContent\\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! Node.js v18.18.0
npm ERR!
npm ERR! at checkExecSyncError (node:child_process:890:11)
npm ERR! at Object.execFileSync (node:child_process:926:15)
npm ERR! at validateBinaryVersion (C:\Users\WebContent\node_modules\esbuild\install.js:98:28)
npm ERR! at C:\Users\WebContent\node_modules\esbuild\install.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(1567) [Uint8Array] [
npm ERR! 110, 111, 100, 101, 58, 99, 104, 105, 108, 100, 95, 112,
npm ERR! 114, 111, 99, 101, 115, 115, 58, 57, 50, 57, 13, 10,
npm ERR! 32, 32, 32, 32, 116, 104, 114, 111, 119, 32, 101, 114,
npm ERR! 114, 59, 13, 10, 32, 32, 32, 32, 94, 13, 10, 13,
npm ERR! 10, 60, 114, 101, 102, 32, 42, 49, 62, 32, 69, 114,
npm ERR! 114, 111, 114, 58, 32, 115, 112, 97, 119, 110, 83, 121,
npm ERR! 110, 99, 32, 67, 58, 92, 85, 115, 101, 114, 115, 92,
npm ERR! 106, 117, 108, 105, 115, 116, 111, 101, 92, 101, 99, 108,
npm ERR! 105, 112, 115, 101,
npm ERR! ... 1467 more items
npm ERR! ]
npm ERR! ],
npm ERR! pid: 22344,
npm ERR! stdout: Buffer(0) [Uint8Array] [],
npm ERR! stderr: Buffer(1567) [Uint8Array] [
npm ERR! 110, 111, 100, 101, 58, 99, 104, 105, 108, 100, 95, 112,
npm ERR! 114, 111, 99, 101, 115, 115, 58, 57, 50, 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,
npm ERR! 10, 60, 114, 101, 102, 32, 42, 49, 62, 32, 69, 114,
npm ERR! 114, 111, 114, 58, 32, 115, 112, 97, 119, 110, 83, 121,
npm ERR! 110, 99, 32, 67, 58, 92, 85, 115, 101, 114, 115, 92,
npm ERR! 106, 117, 108, 105, 115, 116, 111, 101, 92, 101, 99, 108,
npm ERR! 105, 112, 115, 101,
npm ERR! ... 1467 more items
npm ERR! ]
npm ERR! }
npm ERR!
npm ERR! Node.js v18.18.0
It must have something to do with my @angular-devkit/build-angular dependency, because if i delete it from my package.json file it updates.
I have tried removing the nodes-modules and the package-lock file, but the error still occurs.
By the way, my package.json file looks like this:
{
"name": "web-content",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^16.2.8",
"@angular/cdk": "^16.2.7",
"@angular/common": "^16.2.8",
"@angular/compiler": "^16.2.8",
"@angular/core": "^16.2.8",
"@angular/forms": "^16.2.8",
"@angular/material": "^16.2.7",
"@angular/platform-browser": "^16.2.8",
"@angular/platform-browser-dynamic": "^16.2.8",
"@angular/router": "^16.2.8",
"core-js": "^2.4.1",
"ng-chartjs": "^0.0.7",
"rxjs": "^7.8.1",
"tslib": "^2.6.2",
"zone.js": "^0.13.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^16.2.5",
"@angular/cli": "^16.2.5",
"@angular/compiler-cli": "^16.2.8",
"@angular/language-service": "^16.2.8",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.2",
"@types/node": "^14.0.4",
"codelyzer": "^6.0.0",
"fs-monkey": "^1.0.4",
"jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~3.2.0",
"tslint": "~6.1.0",
"typescript": "^4.9.3"
}
}
Does somebody know how to fix this issue?
I have tried removing the nodes-modules and the package-lock file, but the error still occurs.
Solution
The error message you've posted indicates that there's an issue with the installation of the esbuild
package during your Angular project update. It appears to be related to a problem with a binary executable that esbuild
uses. Let's try to resolve this issue step by step:
Update Node.js and NPM: Ensure that you are using the latest version of Node.js and NPM. You can update Node.js by downloading the latest installer from the official website and updating NPM using the following command:
npm install -g npm@latest
Clear NPM Cache: Sometimes, issues can be resolved by clearing the NPM cache. Run the following command:
npm cache clean -f
Clean Node Modules and Reinstall: Clean your project's
node_modules
andpackage-lock.json
file to ensure a clean installation:rm -rf node_modules package-lock.json
Update Angular CLI: Ensure that you are using the latest version of the Angular CLI. You can update it globally using:
npm install -g @angular/cli
Run
npm install
: After cleaning and updating, run:npm install
Try the Update Again: After successfully running
npm install
, attempt to update your Angular project again:ng update
If you are still facing issues, please make sure your system meets the requirements for the latest Angular version. Ensure that you are not running any conflicting versions of Node.js, NPM, or Angular. Additionally, if you are behind a firewall or have any security software that may interfere with package downloads, you might need to configure your environment to allow access to NPM packages.
Answered By - Vamshi Kumar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.