1

After npm install -g @angular/cli this is what I recive:

npm WARN optional Skipping failed optional dependency /@angular/cli/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.2.4
npm ERR! Linux 4.15.0-38-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "@angular/cli"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! path /usr/local/lib
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/local/lib'
npm ERR!  { Error: EACCES: permission denied, access '/usr/local/lib'
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ipaulbogdan/npm-debug.log
1

From https://www.npmjs.com/package/@angular/cli#installation

Install Globablly

npm install -g @angular/cli

Install Locally

npm install @angular/cli

In Linux, every time you install something, when that something is Global means you need root access and when something is Local just with your user is enough


To translate that into commands

Global

sudo npm install -g @angular/cli

Local

npm install @angular/cli


Permission Denied

You can see what is the problem clearly in the log

npm ERR! Error: EACCES: permission denied, access '/usr/local/lib'

Probably the installer wants to write there but can's because only the root user can

  • Thanks man.Appreciate your help.It's working now. – Idorasi Paul Nov 29 '18 at 11:36
  • Please use the answer below to fix the problem. It's not suggested to use sudo to install npm packages on linux. Follow the answer posted by Ashraf Mirghani – Sirajus Salekin Mar 11 at 8:22
1

https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

Back up your computer. On the command line, in your home directory, create a directory for global installations:

 mkdir ~/.npm-global

Configure npm to use the new directory path:

 npm config set prefix '~/.npm-global'

In your preferred text editor, open or create a ~/.profile file and add this line:

 export PATH=~/.npm-global/bin:$PATH

On the command line, update your system variables:

source ~/.profile

To test your new configuration, install a package globally without using sudo:

npm install -g jshint

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.