[英]Problems of installing npm nodemon
As the error suggests you need to run npm install -g with root privileges. 由于错误提示,您需要使用root特权运行npm install -g。
either open an Administration console in Windows, or use sudo in Linux: 在Windows中打开管理控制台,或在Linux中使用sudo:
sudo npm install -g nodemon
If you want to avoid that, you can look into using NVM , which can provide a global node_modules that does not depend on root privileges. 如果要避免这种情况,可以考虑使用NVM ,它可以提供不依赖于root特权的全局node_modules。
You should never need to run npm install -g
with root privileges - if you are getting permission errors then this means that npm has been installed incorrectly. 您永远不需要以root权限运行
npm install -g
如果遇到权限错误,则意味着npm安装不正确。 The npm website provides fairly comprehensive documentation on how to fix this - https://docs.npmjs.com/getting-started/fixing-npm-permissions 故宫网站提供了有关如何解决这一问题相当全面的文档- https://docs.npmjs.com/getting-started/fixing-npm-permissions
The best options are to either use a package manager to install npm, such as Homebrew on MacOS. 最好的选择是使用软件包管理器来安装npm,例如MacOS上的Homebrew。 Node Version Manager (NVM) can also ease the process, as well as providing support for using different node versions.
节点版本管理器(NVM)还可简化此过程,并提供使用不同节点版本的支持。 Alternatively you can either change the ownership of
/usr/local
so that your current user has permissions there, or change the folder used by npm to one owner by the current user. 或者,您可以更改
/usr/local
的所有权,以便您的当前用户在那里拥有权限,或者将npm使用的文件夹更改为当前用户的一个所有者。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.