Fix NPM EACCES permission denied errors (recommended fix) Global Package install

Опубликовано: 14 Октябрь 2024
на канале: Jason Cheung
33,799
287

How to fix eacces permission denied errors with npm when installing a global package using Ubuntu. An easy fix is to install using sudo but this isn't recommended as this gives permissions to scripts that can execute anything it wants which can be harmful.
Instead use the recommended fix from npm: https://docs.npmjs.com/resolving-eacc...
https://docs.npmjs.com/downloading-an...

Solution:
This involves installing nvm https://github.com/nvm-sh/nvm and executing the command:
nvm install node
This will reinstall npm and node using the correct permissions and avoids the eacces permission errors. Once installed can continue as normal.

Like anything else: Always keep a back up before making these changes for an easy revert :)

0:00 - Eacces error with global npm
0:42 - Installing NVM
1:45 - Fix: Installing npm and node with nvm
2:04 - Test npm install global package

––––––––––––––––––––––––––––––
Track: For the People — Artificial.Music [Audio Library Release]
Music provided by Audio Library Plus
Watch:    • For the People — Artificial.Music | F...  ​
Free Download / Stream: https://alplus.io/people​
––––––––––––––––––––––––––––––