node.js - Node js Express 安装错误 'EACCES'、 'no such file'

标签 node.js express installation

我尝试使用终端安装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

最佳答案

您不应该使用 sudo 进行 npm install。试试fixing-npm-permissions

关于node.js - Node js Express 安装错误 'EACCES'、 'no such file',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39929509/

相关文章:

javascript - 重新安装后Expo找不到模块

javascript - Eclipse 打开声明错误 - 未解析为 Javascript 元素

javascript - 在 nodejs Passport.js 中禁用 session

installation - 在 VS2012 中创建 MSI 的 Web 设置替换?

python - Django 安装 - 创建 mysite 目录时出现问题

.NET MSI 安装项目 - 覆盖以前的版本

node.js - 不能同时使用 Node、Mocha 和 Babel@7.x.x

javascript - 相当于 PHP gmdate

api - 休息API : How to search for other attribute

javascript - 在 express/node 中使用全局变量