Reputation: 1331
Was trying to update to the latest version of npm and got this permission error. Was wondering if anything major can go wrong by updating to the latest version of npm and also was sure about the possible errors that might occur with sudo chown -R $USER /usr/local. The advise I read online was to run that to change permissions.
Other than "sudo" if I could get an explanation of what the rest means that'd be cool.
npm i -g npm
/usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
npm ERR! path /usr/local/share/man/man5
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/share/man/man5'
npm ERR! { Error: EACCES: permission denied, mkdir '/usr/local/share/man/man5'
npm ERR! cause:
npm ERR! { Error: EACCES: permission denied, mkdir '/usr/local/share/man/man5'
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/share/man/man5' },
npm ERR! stack: 'Error: EACCES: permission denied, mkdir \'/usr/local/share/man/man5\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/share/man/man5' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
╭─────────────────────────────────────╮
│ │
│ Update available 5.5.1 → 5.6.0 │
│ Run npm i -g npm to update │
│ │
╰─────────────────────────────────────╯
And now after having unsuccessfully tried to update npm when i type npm -v into the terminal i'm getting npm: command not found.
When I run node -v the latest version is v8.9.1
Thx
Upvotes: 2
Views: 1670
Reputation: 4597
Use sudo
to run npm. Changing permissions on /usr/local/
is bad advice.
Upvotes: 1