从终端安装nodemon时出错?实际上我在更新 Nodejs 时也遇到了同样的问题

问题描述 投票:0回答:4

这是抛出的错误,我在更新 Nodejs 时遇到了同样的问题,但是,我设法使用下载选项更新它。但每次我尝试从终端安装nodemon时仍然有这个

JuJu:/ juri$ npm install -g nodemon
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!  [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules'
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/juri/.npm/_logs/2020-06-21T11_25_30_937Z-debug.log
JuJu:/ juri$ 
node.js terminal nodemon
4个回答
2
投票

或者你可以使用

sudo npm install -g nodemon

如果你是 sudoer..


1
投票

尝试使用 nvm 重新安装节点。对我有用。

安装nvm:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

检查是否已安装:

command -v nvm

安装节点:

nvm install node
nvm install <SPECIFIC_NODE_VERSION>

希望这有帮助!


1
投票

要解决此问题,请更改文件夹的所有者。运行此命令:

sudo chown -R $USER /usr/local/lib/node_modules


0
投票

由于您使用的是 MacBook,您需要向终端授予管理权限,因此使用::

sudo npm install -g nodemon
© www.soinside.com 2019 - 2024. All rights reserved.