Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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

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"

I've already tried id. There is no errors, but runningvue --version gives the following output bash: /snap/bin/vue: No such file or directory – Albus_Dalbador Apr 20, 2021 at 18:24

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.