To install a Bootstrap theme I want to run npm install. However I always receive a permission denied error.
I already tried nvm
and then switched with nvm use 10.9.0
to run npm install
.
I also tried sudo chown -R $(whoami) ~/.npm
and sudo chown -R $USER /usr/local/lib/node_modules
. Neither solved it and now I am bit out of ideas how I can continue. I use macOS High Sierra.
Marcs-MBP-3:masterclass Marc$ npm install
npm WARN deprecated gulp-uglifyjs@0.6.2: Since gulp-sourcemaps now works, use gulp-uglify instead
npm WARN deprecated babel-preset-es2015@6.24.1:
Check permissions of your project root with
ls -l /Users/Marc/Desktop/Dev/masterclass/
. If the owner is not$USER
, delete yournode_modules
directory, try changing the owner of that directory instead and runnpm install
again.I was having a similar issue, but the accepted answer did not work for me, so I will post my solution in case anyone else comes along needing it.
I was running
npm install
in a project cloned from GitHub and during the clone, for whatever reason the write permission was not actually set on the project directory. To check if this is your problem, pull up Terminal and enter the following:If the directory has user write access, the output will include a
w
in the first group of permissions:This assumes that you're trying to access a project in the home directory structure of the current user. To make sure that the current user owns the project directory, follow the instructions in the accepted answer.
For Mac;
Run this on the Terminal >