I'm trying to generate a new Angular project:
npm install -g @angular/cli
and there popped up an ERROR which I don't know how to solve:
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules/@angular/cli/node_modules/@schematics/update/node_modules/npm-package-arg/node_modules/semver
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/@angular/cli/node_modules/@schematics/update/node_modules/npm-package-arg/node_modules/semver'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/@angular/cli/node_modules/@schematics/update/node_modules/npm-package-arg/node_modules/semver']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules/@angular/cli/node_modules/@schematics/update/node_modules/npm-package-arg/node_modules/semver\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path:
npm ERR! '/usr/local/lib/node_modules/@angular/cli/node_modules/@schematics/update/node_modules/npm-package-arg/node_modules/semver' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/simonanikolova/.npm/_logs/2020-07-04T16_47_21_985Z-debug.log
Some other specific things which may be relevant to the problem:
I have two logins on my Mac OS: admin user and personal user
macOS Catalina version: 10.15.5
npm version: 6.14.5
TypeScript version: 3.5.3
Angular version:
Angular CLI: 9.0.0 Node: 10.16.1 OS: darwin x64
Angular: undefined ... Ivy Workspace:
Package Version @angular-devkit/architect 0.900.0 (cli-only) @angular-devkit/core 9.0.0 (cli-only) @angular-devkit/schematics 9.0.0 (cli-only) @schematics/angular 9.0.0 (cli-only) @schematics/update 0.900.0 (cli-only) webpack 4.43.0
ALSO: During my research how to solve the problem I have tried to change my file permission: I switched to my admin user and typed in the terminal:
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
I will be very happy if somebody could help me! Thank you!