LoginSignup
25

More than 5 years have passed since last update.

Mac OS X で npm install 時に権限まわりでエラーが出たときの解決方法

Last updated at Posted at 2015-05-05

環境: MacOSX Yosemite 10.10.3

npm install gulp

で以下のエラー

npm WARN package.json blogtest@1.0.0 No description
npm WARN package.json blogtest@1.0.0 No repository field.
npm WARN package.json blogtest@1.0.0 No README data
npm WARN locking Error: EACCES, open '/Users/username/.npm/_locks/gulp-9990ecbe64c4571f.lock'
npm WARN locking     at Error (native)
npm WARN locking  /Users/username/.npm/_locks/gulp-9990ecbe64c4571f.lock failed { [Error: EACCES, open '/Users/username/.npm/_locks/gulp-9990ecbe64c4571f.lock']
npm WARN locking   errno: -13,
npm WARN locking   code: 'EACCES',
npm WARN locking   path: '/Users/username/.npm/_locks/gulp-9990ecbe64c4571f.lock' }
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "gulp"
npm ERR! node v0.12.2
npm ERR! npm  v2.7.5

npm ERR! Attempt to unlock /Users/username/work/practice/20150505/blogtest/node_modules/gulp, which hasn't been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/username/work/practice/20150505/blogtest/npm-debug.log

/Users/username/.npm/_locks 以下の権限がrootになっているのでエラーになっている模様

sudo chown -R `whoami` ~/.npm/_locks/

で権限変更するとうまくいく

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
25