Reputation: 9229
I am trying to install this MEAN application generator on my mac - OSX El Capitan v10.11.4. However, I get the following output:
Checking permissions...
Cloning branch master into destination folder: eval
git clone --depth 1 -b master https://github.com/datatypevoid/vulgar.git "eval"
/usr/local/bin/npm There are 2 files in your ~/.npm owned by root Please change the permissions by running - chown -R
whoami
~/.npm/usr/local/lib/node_modules/vulgar-cli/lib/install.js:84 throw err;
The command won't run if I use sudo
. I get an error saying the command can't be run as the root user.
I have run chown -R georgeedwards ~/.npm
, which ran without any error, but I still get the same result.
What should I do to avoid this issue?
Upvotes: 0
Views: 2788
Reputation: 303
If the problem persists, on mac the following worked for me:
Run these steps:
https://stackoverflow.com/a/40717226/11302398
and then:
npm config get prefix
/Users/user_name/.npm-global
sudo chown -R $(whoami) ~/.npm
sudo chown -R $(whoami) /Users/user_name/.npm-global
open a new console and run:
npm doctor
Upvotes: 0
Reputation: 11
I solved this problem by changing npm's
default 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
I found this at
https://docs.npmjs.com/getting-started/fixing-npm-permissions.
Upvotes: 1