Home > Mobile >  npm, global install failing, getting Error: EACCES: permission denied
npm, global install failing, getting Error: EACCES: permission denied

Time:03-24

So I'm logged in as administrator of my MacBook and want to run a npm command in my Django project. However, It refuses due to missing permissions.

(venv) jonas@Air-von-Jonas salaryx % npm install -g sass
npm ERR! code EACCES
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/sass/sass.js
npm ERR! dest /usr/local/bin/sass
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/sass/sass.js' -> '/usr/local/bin/sass'
npm ERR!  [Error: EACCES: permission denied, symlink '../lib/node_modules/sass/sass.js' -> '/usr/local/bin/sass'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../lib/node_modules/sass/sass.js',
npm ERR!   dest: '/usr/local/bin/sass'
npm ERR! }
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/jonas/.npm/_logs/2022-03-24T06_04_35_362Z-debug.log
(venv) jonas@Air-von-Jonas salaryx % 

Also it seems that I can't change permissions of a folder, I can unlock the lock on the bottom right but then once I try to change permission for "wheel" e.g. it refuses as well.

enter image description here

CodePudding user response:

An easy way to install globally a npm package is with the use of sudo command, like so:

sudo npm install -g sass
  • Related