1

Good evening everybody! I'm trying to install vue.js on my linux mint using npm. When I run the simple command given in vue tutorial:

npm install -g @vue/cli

After some warnings the following errors appear in terminal:

 npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib'
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib']
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, access \'/usr/local/lib\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib' }
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!     and path to error log here

I understand, that "the operation was rejected by my operation system" But I have no idea, how to fix it. I will be grateful if someone helps me with this, as I suppose simple problem

Albus_Dalbador
  • 61
  • 2
  • 10

2 Answers2

3

There is another solution that I found at another discution here o stackoverflow: npm throws error without sudo

Basicaly what is happening is that NPM does not have the privileges to access /usr/local/lib. To give it access, you could change the ownership of ~/.npm in order to belong to your current user. This could be this way:

sudo chown -R $(whoami) ~/.npm

This way you do not have to run npm as sudo, which is not recomended. I believe that it is due to vulnerabilities that are known in npm packages.

Here is an article about it: Don't use "sudo" with npm "install"

0

try sudo npm install -g @vue/cli

Noy Gafni
  • 1,091
  • 9
  • 19