Nadia Belhassen
Nadia Belhassen

Reputation: 41

npm install Failed at the @angular/[email protected] postinstall script

I'm just starting out, I need to set up a source code on my machine.

node -v v12.16.1 npm -v 6.13.4

can you help me resolve this error when I run the npm install command ( on Windows 7 Entreprise SP1 64-bit)

4400 verbose stack Error: @angular/[email protected] postinstall: `node 
./bin/postinstall/script.js`
4400 verbose stack Exit status 1
4400 verbose stack     at EventEmitter.<anonymous> (C:\Program 
Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
4400 verbose stack     at EventEmitter.emit (events.js:311:20)
4400 verbose stack     at ChildProcess.<anonymous> (C:\Program 
Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
4400 verbose stack     at ChildProcess.emit (events.js:311:20)
4400 verbose stack     at maybeClose (internal/child_process.js:1021:16)
4400 verbose stack     at Process.ChildProcess._handle.onexit 
(internal/child_process.js:286:5)
4401 verbose pkgid @angular/[email protected]
4402 verbose cwd D:\banbou_source\workspace\banbou-project\banbou-backoffice- 
client
4403 verbose Windows_NT 6.1.7601
4404 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program 
Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
4405 verbose node v12.16.1
4406 verbose npm  v6.13.4
4407 error code ELIFECYCLE
4408 error errno 1
4409 error @angular/[email protected] postinstall: `node ./bin/postinstall/script.js`
4409 error Exit status 1
4410 error Failed at the @angular/[email protected] postinstall script.
4410 error This is probably not a problem with npm. There is likely 
additional 
logging output above.
4411 verbose exit [ 1, true ]

Upvotes: 2

Views: 2764

Answers (4)

burkybang
burkybang

Reputation: 117

I don't know which of these did the trick or if it was a combination, but this worked for me after trying so many other answers.

I opened a command prompt as administrator in Windows, and I ran the following command.

npm install -g @angular/[email protected] --unsafe-perm --force

Upvotes: 1

Nadia Belhassen
Nadia Belhassen

Reputation: 41

Thanks for all the problem solved following the addition of the --force option

npm i -g @angular/cli --force

Upvotes: 2

Surya
Surya

Reputation: 638

Try installing angular-cli with --unsafe-perm flag. In Windows, it might be permission issue while installing postinstall.

Upvotes: 1

bhawanishiv
bhawanishiv

Reputation: 345

ou must check whether any previous version on Agnular is installed (or even partially) on your computer. If so, then run command:

npm uinstall @angular/cli

Then clean the npm cache by this command: npm cache clean --force

Now, try to re-install Angular by the command: npm i -g @angular/cli The current version of Angular is 9.1.3 so you don't need write it in the command.

Here -g command is used to install Angular globally.

For everything to work fine, please close all IDE (if being used) then perform above oprations.

Upvotes: 1

Related Questions