【问题标题】:node js express install error 'EACCES', 'no such file'node js express安装错误'EACCES','没有这样的文件'
【发布时间】:2016-10-08 06:41:02
【问题描述】:

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

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

【问题讨论】:

  • 我认为你的第一个问题是$USER 是一个特殊变量,你不应该用你的计算机用户名替换它,或者如果你这样做应该是一个字符串,而不是一个变量。

标签: node.js express installation


【解决方案1】:

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

【讨论】:

    【解决方案2】:

    以root身份运行命令,因此命令将是sudo npm install

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-10
      • 2017-05-24
      相关资源
      最近更新 更多