2
Error: EACCES: permission denied, access \'/Users/gs/.npm-global/lib/node_modules/@angular/cli\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path:
npm ERR!    '/Users/gs/.npm-global/lib/node_modules/@angular/cli' }

The operation was rejected by your operating system.
It is likely you do not have the permissions to access this file as the current user

if you believe this might be a permissions issue, please double-check the
permissions of the file and its containing directories, or try running
the command again as root/Administrator (though this is not recommended).

What's interesting when I tried the sudo version it downloads but ng is not recognized in the terminal.

My node is 10.16.3 and my npm is 6.9.0

Is this a file issue or my Mac?

ulmas
  • 2,203
  • 16
  • 22
John Simelus
  • 21
  • 1
  • 3
  • make sure you have admin rights to install it globally – Aravind Jan 14 '20 at 18:55
  • Doing a global npm install on Mac OS X is tricky with plenty of potential issues. Try the answers from here: https://stackoverflow.com/questions/33725639/npm-install-g-less-does-not-work-eacces-permission-denied – ulmas Jan 14 '20 at 19:06
  • Have you tried with sudo? The global node_modules needs sudo permissions. – Naor Levi Jan 14 '20 at 19:37
  • I removed the -g and it worked.. (so far). I think this will be fine for just my user – Bhikkhu Subhuti May 08 '20 at 03:22

2 Answers2

1

You can find the solution of this question here.
Or
Simply follow the steps from here.

Prakash Dahal
  • 430
  • 3
  • 6
1
  1. On the command line, in your home directory, create a directory for global installations:

    mkdir ~/.npm-global

  2. Configure npm to use the new directory path:

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

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

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

  4. On the command line, update your system variables:

    source ~/.profile

  5. You are good install the packages globally

    npm install -g @angular/cli