I recently updated my npm
version to 2.5.1 and when I installed express
locally in my project under node_modules
using npm install express --save
it came up with this error:
npm WARN locking Error: EACCES, open '/Users/patrick/.npm/_locks/express-44e9a2fe3cb5b729.lock'
npm WARN locking at Error (native)
npm WARN locking /Users/patrick/.npm/_locks/express-44e9a2fe3cb5b729.lock failed { [Error: EACCES, open '/Users/patrick/.npm/_locks/express-44e9a2fe3cb5b729.lock']
npm WARN locking errno: -13,
npm WARN locking code: 'EACCES',
npm WARN locking path: '/Users/patrick/.npm/_locks/express-44e9a2fe3cb5b729.lock' }
npm ERR! Darwin 13.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "express" "--save"
npm ERR! node v0.12.0
npm ERR! npm v2.5.1
npm ERR! Attempt to unlock (path to project here)/node_modules/express, which hasn't been locked
When I ran it again with sudo
it worked fine, but now my text editor requires me to type in my password every time I overwrite files in the project folder. Why is this happening and how do I fix it?
Note, I not only want to prevent local installs from requiring sudo, but I also want to unlock the project folder so I don't have to keep typing in my password in the text editor.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…