Installing the node dependency prompt does not have access to the .npm directory.

  

The project generation tool that previously installed Express with NPM globally: npm install -g express-generator

Recently generated by the express command on the Mac When the Express project was found to be in the project, it was not possible to install project dependencies via npm install. Express ExpressProjectName

Prompt for access to the .npm directory. Npm ERR! Error: EACCES, open '/Users/xyq/.npm/debug/0.7.4/package/package.json'npm ERR! { [Error: EACCES, open '/Users/xyq/.npm/debug/0.7.4/package/package.json']npm ERR! errno: 3,npm ERR! code: 'EACCES',npm ERR! path: '/Users/xyq/.npm/debug/0.7.4/package/package .json',npm ERR! parent: 'sohunews-node' }npm ERR!npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 13.2.0npm ERR! command " ;node" "/usr/local/bin/npm" "install"npm ERR! cwd /Users/xyq/project/sohu/sohunews-nodenpm ERR! node -v v0.10.29npm ERR! npm -v 1.4. 14npm ERR! path /Users/xyq/.npm/debug/0.7.4/package/package.jsonnpm ERR! code EACCESnpm ERR! errno 3npm ERR! stack Error: EACCES, open '/Users/xyq/.npm/debug/0.7.4/package/package.json'npm ERR!npm ERR! Additional logging details can be found in:npm ERR! /Users/xyq/project/sohu/sohunews-node/npm-debug.lognpm ERR! not ok code 0

It may be because the .npm directory was created under the root user. I currently executing user npm install the non-root user. SO, it is OK to change the .npm directory permissions in the root directory to the current user's permissions. Sudo chown -R $USER:$GROUP ~/.npm

If it still doesn't work, then emptying the tmp directory should work fine. Rmdir ~/tmp

Now executing npm install should be able to install project dependencies normally.

Copyright © Windows knowledge All Rights Reserved