npm install permission denied (macOS)
Full error message
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) ~/.npmand 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 [email protected]: Since gulp-sourcemaps now works, use gulp-uglify instead npm WARN deprecated [email protected]: π Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update! npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools. npm WARN checkPermissions Missing write access to /Users/Marc/Desktop/Dev/masterclass/node_modules npm ERR! path /Users/Marc/Desktop/Dev/masterclass/node_modules npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access npm ERR! Error: EACCES: permission denied, access '/Users/Marc/Desktop/Dev/masterclass/node_modules' npm ERR! { [Error: EACCES: permission denied, access '/Users/Marc/Desktop/Dev/masterclass/node_modules'] npm ERR! stack: npm ERR! 'Error: EACCES: permission denied, access \'/Users/Marc/Desktop/Dev/masterclass/node_modules\'', npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/Users/Marc/Desktop/Dev/masterclass/node_modules' } 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 (though this is not recommended). npm ERR! A complete log of this run can be found in: npm ERR! /Users/Marc/.npm/_logs/2018-08-22T12_46_51_786Z-debug.log
Solutionsource: stackoverflow \u2197
Check permissions of your project root with ls -l /Users/Marc/Desktop/Dev/masterclass/. If the owner is not $USER, delete your node_modules directory, try changing the owner of that directory instead and run npm install again. cd /Users/Marc/Desktop/Dev rm -rf ./masterclass/node_mdoules/ chown -R $USER ./masterclass/ cd masterclass npm install
API access
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/77d0809e3e0bf7b078cd88633c240bd8f9645cceb134b2f1755904f1ee8c8f3fhash \u00b7 77d0809e3e0bf7b078cd88633c240bd8f9645cceb134b2f1755904f1ee8c8f3f