【问题标题】:How can I install NPM?如何安装 NPM?
【发布时间】:2022-01-17 02:33:25
【问题描述】:

写完npm install -g npm我得到:

npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! dest /usr/local/lib/node_modules/.npm-i9nnxROI
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/npm' -> '/usr/local/lib/node_modules/.npm-i9nnxROI'
npm ERR!  [Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/npm' -> '/usr/local/lib/node_modules/.npm-i9nnxROI'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'rename',
npm ERR!   path: '/usr/local/lib/node_modules/npm',
npm ERR!   dest: '/usr/local/lib/node_modules/.npm-i9nnxROI'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/marc/.npm/_logs/2021-12-13T16_06_54_229Z-debug.log

【问题讨论】:

标签: node.js npm npm-install


【解决方案1】:

这是一个权限问题。如果您使用的是 Mac,请使用:

sudo npm install (whatever your package name is)

然后它会提示您在计算机上输入密码。这样做会解决它。

如果您不在 Mac 上,我会为此找到 sudo 的等效项。

【讨论】:

  • 非常感谢!
猜你喜欢
  • 2014-06-15
  • 2016-09-05
  • 2011-11-27
  • 1970-01-01
  • 2021-04-13
  • 2016-06-02
  • 2022-07-05
  • 2021-08-24
  • 2018-09-08
相关资源
最近更新 更多