Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
Full error message
What might be causing the error Error: EACCES: permission denied, access '/usr/local/lib/node_modules'?
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/macbookmd101/.npm/_logs/2018-02-21T16_26_08_421Z-debug.logSolutionsource: stackoverflow \u2197
Change your file permissions... Like this First check who owns the directory ls -la /usr/local/lib/node_modules it is denying access because the node_module folder is owned by root drwxr-xr-x 3 root wheel 102 Jun 24 23:24 node_modules so this needs to be changed by changing root to your user but first run command below to check your current user How do I get the name of the active user via the command line in OS X? id -un OR whoami Then change owner sudo chown -R [owner]:[owner] /usr/local/lib/node_modules OR sudo chown -R ownerName: /usr/local/lib/node_modules OR sudo chown -R $USER /usr/local/lib/node_modules
API access
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/023b0e42ab466362a7c4d5207962e0e41e3d518c0ba2f084ef9a7bb1b4c45225hash \u00b7 023b0e42ab466362a7c4d5207962e0e41e3d518c0ba2f084ef9a7bb1b4c45225