2

I wanted to update new version of npm 6.4.0 from npm 6.1.0 , using cli command

npm install -g npm

but I got error while updating

npm ERR! path /usr/local/lib/node_modules/npm/node_modules/ansi-regex
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm/node_modules/ansi-regex'
npm ERR!  { Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm/node_modules/ansi-regex'
npm ERR!   stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules/npm/node_modules/ansi-regex\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules/npm/node_modules/ansi-regex' }
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 (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/user/.npm/_logs/2018-08-23T06_53_24_306Z-debug.log
  • as the error message says, you need sudo rights to install. Add `sudo` infront of your install command as `sudo npm install -g npm` – BlizZard Aug 23 '18 at 07:12

1 Answers1

0

For ubuntu/linux you have to use below command :

sudo npm install -g npm
ranakrunal9
  • 13,320
  • 3
  • 42
  • 43