5

My system configuration:
debian 4.4 , nvm 0.33.8 , node v8.9.4 , npm 5.6.0 .

I want to install Angular-cli npm install -g @angular/cli. But I get an error message:

root@contracts:/home/kalugin# npm install -g @angular/cli
/root/.nvm/versions/node/v8.9.4/bin/ng -> /root/.nvm/versions/node/v8.9.4/lib/node_modules/@angular/cli/bin/ng
> [email protected] install /root/.nvm/versions/node/v8.9.4/lib/node_modules/@angular/cli/node_modules/node-sass
> node scripts/install.js
module.js:471
  throw err;
  ^
Error: Cannot find module '/root/.nvm/versions/node/v8.9.4/lib/node_modules/@angular/cli/node_modules/node-sass/scripts/install.js'
  at Function.Module._resolveFilename (module.js:469:15)
  at Function.Module._load (module.js:417:25)
  at Module.runMain (module.js:604:10)
  at run (bootstrap_node.js:394:7)
  at startup (bootstrap_node.js:149:9)
  at bootstrap_node.js:509:3
> [email protected] postinstall /root/.nvm/versions/node/v8.9.4/lib/node_modules/@angular/cli/node_modules/webpack/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js
module.js:471
  throw err;
  ^
Error: Cannot find module '/root/.nvm/versions/node/v8.9.4/lib/node_modules/@angular/cli/node_modules/webpack/node_modules/uglifyjs-webpack-plugin/lib/post_install.js'
  at Function.Module._resolveFilename (module.js:469:15)
  at Function.Module._load (module.js:417:25)
  at Module.runMain (module.js:604:10)
  at run (bootstrap_node.js:394:7)
  at startup (bootstrap_node.js:149:9)
  at bootstrap_node.js:509:3
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/@angular/cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/@angular/cli/node_modules/node-sass):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node scripts/install.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node lib/post_install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-02-09T17_27_50_397Z-debug.log

I tried npm cache clean, doesn't help.
I tried change node version nvm use v6.12.3, doesn't help.

debug.log pointed to the problem with node-sass package. I tried install node-sass globally - but the same error. I cannot install node-sass...

Any ideas?

3 Answers 3

14

Likely the problem is because you're running as root, and NPM disables scripts automatically when you do that. Try passing the --unsafe-perm to the NPM install command

Sign up to request clarification or add additional context in comments.

2 Comments

Saved my 3 hours troubleshooting
Thanks man, i thought i was gonna commit a suicide: i stopped ng serve, rerunned it, and it crashed... A WTF moment!
4

Try npm rebuild node-sass it can be a handy one

2 Comments

This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
How is this not answer?
0

Actually the problem is due to use of sudo in command as it is disabling the scripts. Try npm install -g angular-cli without sudo it will work

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.