Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error with install angular-cli with node-sass

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?

like image 399
kaluginserg Avatar asked Feb 09 '18 18:02

kaluginserg


People also ask

Does angular use node sass?

Angular CDK and Angular Material have internally adopted Sass's new module system. If your application uses Angular CDK or Angular Material, you'll need to make sure you've switched from node-sass to the sass npm package.

Will npm install install angular cli?

NPM is one of the prerequisites you require before installing Angular CLI. Angular will need to have Node. js in your system for it to run (the 8.

What is npm node sass?

Node sass is a library that allows binding for Node. js to LibSass, the C version of Sass's stylesheet preprocessor. It compiles . scss files to CSS with speed and automatically through connected middleware. SASS (Syntactically Awesome Style Sheets) is a comprehensive version of CSS.

Is node sass the same as Sass?

[1]: Node-sass is a library that provides binding for Node. js to LibSass, the C version of the popular stylesheet preprocessor, Sass.


1 Answers

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

like image 75
nschonni Avatar answered Sep 25 '22 15:09

nschonni