node js express安装错误'EACCES','没有这样的文件'

时间:2016-10-08 06:41:02

标签: node.js express install

我尝试使用终端安装快递, 但我不断收到此错误消息。 我不熟悉终端,我不知道如何解决这个问题。

camila-ui-MacBook-Pro:myapp camila$ sudo chown -R $camila /usr/local
usage: chown [-fhv] [-R [-H | -L | -P]] owner[:group] file ...
       chown [-fhv] [-R [-H | -L | -P]] :group file ...
camila-ui-MacBook-Pro:myapp camila$ npm install
npm WARN locking Error: EACCES: permission denied, open '/Users/camila/.npm/_locks/staging-ecf78f8592840908.lock'
npm WARN locking     at Error (native)
npm WARN locking  /Users/camila/.npm/_locks/staging-ecf78f8592840908.lock failed { Error: EACCES: permission denied, open '/Users/camila/.npm/_locks/staging-ecf78f8592840908.lock'
npm WARN locking     at Error (native)
npm WARN locking   errno: -13,
npm WARN locking   code: 'EACCES',
npm WARN locking   syscall: 'open',
npm WARN locking   path: '/Users/camila/.npm/_locks/staging-ecf78f8592840908.lock' }
npm WARN enoent ENOENT: no such file or directory, open '/Users/camila/package.json'
npm WARN camila No description
npm WARN camila No repository field.
npm WARN camila No README data
npm WARN camila No license field.
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v6.7.0
npm ERR! npm  v3.10.3
npm ERR! path /Users/camila/.npm/_locks/staging-ecf78f8592840908.lock
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open

npm ERR! Error: EACCES: permission denied, open '/Users/camila/.npm/_locks/staging-ecf78f8592840908.lock'
npm ERR!     at Error (native)
npm ERR!  { Error: EACCES: permission denied, open '/Users/camila/.npm/_locks/staging-ecf78f8592840908.lock'
npm ERR!     at Error (native)
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'open',
npm ERR!   path: '/Users/camila/.npm/_locks/staging-ecf78f8592840908.lock' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v6.7.0
npm ERR! npm  v3.10.3
npm ERR! path npm-debug.log.2501560768
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open

npm ERR! Error: EACCES: permission denied, open 'npm-debug.log.2501560768'
npm ERR!     at Error (native)
npm ERR!  { Error: EACCES: permission denied, open 'npm-debug.log.2501560768'
npm ERR!     at Error (native)
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'open',
npm ERR!   path: 'npm-debug.log.2501560768' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/camlia/myapp/npm-debug.log

2 个答案:

答案 0 :(得分:0)

以root身份运行命令,命令将为sudo npm install

答案 1 :(得分:0)

您不应将sudo用于npm install。试试fixing-npm-permissions