https://docs.npmjs.com/getting-started/fixing-npm-permissions
You may receive an EACCES
error when you try to install a package globally. This indicates that you do not have permission to write to the directories that npm uses to store global packages and commands.
You can fix this problem using one of two options:
- Change the permission to npm’s default directory.
- Change npm’s default directory to another directory.
You should back-up your computer before moving forward.
Option 1: Change the permission to npm’s default directory
- Find the path to npm’s directory:
npm config get prefix
For many systems, this will be /usr/local
.
WARNING: If your path is /usr
, switch to option 2.
- Change the owner of npm’s directory’s to the effective name of the current user (your username!):
sudo chown -R `whoami` <directory>
If you don’t want to change the permissions on the entire directory, you can change permissions on the subfolders lib/node_modules
, bin
, and share
.
Option 2: Change npm’s default directory to another directory
There are times when you do not want to change ownership of the default directory that npm uses; for example, if you are sharing a machine with other users.
In this case, you can configure npm to use a different directory.
- Make a directory for global installations:
mkdir ~/npm-global
- Configure npm to use the new directory path:
npm config set prefix '~/npm-global'
- Open or create a
~/.profile
file and add this line:export PATH=~/npm-global/bin:$PATH
- Back on the command line, update your system variables:
source ~/.profile
Test: Download a package globally without using sudo
.
npm install -g jshint
wondering which blog platform are you using for this website?
I’m getting fed up of WordPress because I’ve had issues with hackers and I’m looking at alternatives for another platform.
I would be awesome if you could point me in the direction of a good platform.
impressed to read all at one place.
article at this site.
of space . Exploring in Yahoo I at last stumbled upon this
web site. Studying this information So i’m glad to exhibit that
I’ve a very just right uncanny feeling I discovered just what
I needed. I such a lot certainly will make certain to don?t
forget this site and give it a look on a relentless basis.
and it has aided me out loads. I am hoping to contribute & aid
different customers like its helped me. Great job.
recent news posted here.
this article as well as from our dialogue made at this place.
setting up new weblog or even a blog from start to end.
see this webpage, Keep up the pleasant work.
Your website offered us with useful information to work
on. You’ve performed an impressive job and our entire community
will probably be thankful to you.
or reviews, but this blog presents quality based posts.
in my view its truly awesome in support of me.
could assume you’re an expert on this subject. Fine with your permission let me
to grab your feed to keep updated with forthcoming post.
Thanks a million and please keep up the gratifying work.
at this web site, I have read all that, so at this time me also commenting
at this place.