Janis Rozenfelds
Janis Rozenfelds

Reputation: 29

Can not instal Angular cli on MacOS High Sierra v10.13.2

I have a problem installing Angular cli. I Instal the latest NodeJs v8.9.4 and npm v5.6.0. When I start installing npm install -g @angular/cli after that shows this message:

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

Operating system: MacOS High Sierra v10.13.2

I am not expert but if I understand I do not have permission to install. Thank you for your help 😊.

Upvotes: 0

Views: 889

Answers (2)

Janis Rozenfelds
Janis Rozenfelds

Reputation: 29

Sorry for so long to reply. sudo npm install -g @angular/cli did not help me. I get the same result.

Basically, this is how I solve the problem.

To not get "permission denied" to installing nodejs and npm on macOS High Sierra. I used https://brew.sh . Allowed to install without errors or "permission denied".

Here is some source:

Upvotes: 1

Van Boughner
Van Boughner

Reputation: 344

You need to use this:

sudo npm install -g @angular/cli 

and then enter your administrator password when prompted.

There's a debate on whether you should ever use sudo when using npm install -g, but I use sudo like this when I need to and haven't suffered for it.

Here's a similar stackoverflow question about this: npm throws error without sudo

Upvotes: 0

Related Questions