Home > Blockchain >  EACCES error every time I try and do something with npm
EACCES error every time I try and do something with npm

Time:07-12

Whenever I do anything related to npm, including uninstalling npm itself, I get this error:

npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/local/bin/corepack
npm ERR! dest /usr/local/bin/.corepack-0KY6b4OJ
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/usr/local/bin/corepack' -> '/usr/local/bin/.corepack-0KY6b4OJ'
npm ERR!  [Error: EACCES: permission denied, rename '/usr/local/bin/corepack' -> '/usr/local/bin/.corepack-0KY6b4OJ'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'rename',
npm ERR!   path: '/usr/local/bin/corepack',
npm ERR!   dest: '/usr/local/bin/.corepack-0KY6b4OJ'
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.

This didn't use to be the case as I have had no issues in the past, although the last time I tried to use an npm-related command was about a year ago.

I've tried many solutions, including sudo, nvm and uninstalling Node completely but nothing seems to work. I haven't used Node much before so I'm not very familiar with it unfortunately, so any help would be greatly appreciated.

CodePudding user response:

run npm package as administrator by using the command

sudo npm install -g npm@latest

CodePudding user response:

Turns out it was an issue with my antivirus software! After disabling the software and installing NVM everything now works fine.

  • Related