{"id":89,"hash":"200dc8ab2fa86ecbe051c5afa61dc0715a1cf0c967049089a00cc1e6623a8cfc","pattern":"How to fix npm throwing error without sudo","full_message":"I just installed node and npm through the package on nodejs.org, and whenever I try to search or install something with npm, it throws the following error unless I sudo the command.  I have a feeling this is a permissions issue?  I am already the admin.\n\nnpm ERR! Error: EACCES, open '/Users/chietala/.npm/-/all/.cache.json'\nnpm ERR!  { [Error: EACCES, open '/Users/chietala/.npm/-/all/.cache.json']\nnpm ERR!   errno: 3,\nnpm ERR!   code: 'EACCES',\nnpm ERR!   path: '/Users/chietala/.npm/-/all/.cache.json' }\nnpm ERR! \nnpm ERR! Please try running this command again as root/Administrator.\n\nnpm ERR! System Darwin 12.2.0\nnpm ERR! command \"node\" \"/usr/local/bin/npm\" \"search\" \"bower\"\nnpm ERR! cwd /Users/chietala\nnpm ERR! node -v v0.10.4\nnpm ERR! npm -v 1.2.18\nnpm ERR! path /Users/chietala/.npm/-/all/.cache.json\nnpm ERR! code EACCES\nnpm ERR! errno 3\nnpm ERR! stack Error: EACCES, open '/Users/chietala/.npm/-/all/.cache.json'\nnpm ERR! \nnpm ERR! Additional logging details can be found in:\nnpm ERR!     /Users/chietala/npm-debug.log\nnpm ERR! not ok code 0","ecosystem":"npm","package_name":"node.js","package_version":null,"solution":"Watch OUT!!! Watch OUT!!! Watch OUT!!!\nchown or chmod is NOT the solution, because of security-risk.\n\nInstead do this, do:\n\nFirst check, where npm point to, if you call:\n\nnpm config get prefix\n\nIf /usr is returned, you can do the following:\n\nmkdir ~/.npm-global\nexport NPM_CONFIG_PREFIX=~/.npm-global\nexport PATH=$PATH:~/.npm-global/bin\n\nThis create a npm-Directory in your Home-Directory and point npm to it.\n\nTo got this changes permanent, you have to add the export-command to your .bashrc:\n\necho -e \"export NPM_CONFIG_PREFIX=~/.npm-global\\nexport PATH=\\$PATH:~/.npm-global/bin\" >> ~/.bashrc","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/16151018/how-to-fix-npm-throwing-error-without-sudo","votes":1524,"created_at":"2026-04-19T04:41:18.781988+00:00","updated_at":"2026-04-19T04:51:01.806337+00:00"}