ANGULAR CLI ERROR

1

I have a problem installing angular-cli on a docker.

I'm running the command

npm install -g @angular/cli@latest

and it shows me the error attached

  

/root/.nvm/versions/node/v8.6.0/bin/ng - >   /root/.nvm/versions/node/v8.6.0/lib/node_modules/@angular/cli/bin/ng

     

- > [email protected] install /root/.nvm/versions/node/v8.6.0/lib/node_modules/@angular/cli/node_modules/node-sass   - > node scripts / install.js

     

sh: 1: node: Permission denied

     

- > [email protected] postinstall /root/.nvm/versions/node/v8.6.0/lib/node_modules/@angular/cli/node_modules/uglifyjs-webpack-plugin   - > node lib / post_install.js

     

sh: 1: node: Permission denied 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:   spawn ENOENT

     

npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm   ERR! syscall spawn npm ERR! [email protected] postinstall:    node lib/post_install.js npm ERR! spawn ENOENT 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/2017-10-02T04_39_45_327Z-debug.log

    
asked by Sebastian Samayoa 02.10.2017 в 06:46
source

2 answers

0

Execute the following command:

npm config set unsafe-perm true

Default value: false if running as root , true otherwise, Type: Boolean set to true to suppress UID / GID switching when running package scripts. If set explicitly in false , an error will occur when installing as a user not root .

see the link

sh: 1: node: Permission denied

Example:

problem:

> node install.js

sh: 1: node: Permission denied

Solution:

npm config set user 0
npm config set unsafe-perm true
sudo npm install -g sm

unsafe-perm is insecure, but you should not need sudo or perms insecure to do anything with node / npm.

    
answered by 02.10.2017 / 16:41
source
0

Run it as root :

sudo npm install -g @angular/cli@latest

    
answered by 02.10.2017 в 12:18