繁体   English   中英

Nodejs 显示 EPERM 错误,我该如何解决?

[英]Nodejs is showing error EPERM, how can i fix it?

 PS C:\\New folder> npm install -g yo generator-code npm ERR! code EPERM npm ERR! syscall mkdir npm ERR! path C:\\Program Files\\nodejs\\node_modules\\generator-code npm ERR! errno -4048 npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\\Program Files\\nodejs\\node_modules\\generator-code' npm ERR! [Error: EPERM: operation not permitted, mkdir 'C:\\Program Files\\nodejs\\node_modules\\generator-code'] { npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall: 'mkdir', npm ERR! path: 'C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\generator-code' npm ERR! } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It's possible that the file was already in use (by a text editor or antivirus), npm ERR! or that you lack permissions to access it. 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! C:\\Users\\Forever\\AppData\\Local\\npm-cache\\_logs\\2020-11-25T04_10_40_095Z-debug.log

当我尝试安装 npm install -g yo generator-code 时,它​​显示此错误。 我已经在 Linux 上的 Windows 1 上运行了 3 次 2 但每次它都显示此错误我该如何修复它

这是一个许可问题

我建议you configure npm to not require sudo/Admin permission to install global packages

现在只需downgrade your npm version或使用“管理员权限”运行您的 cmd。

如果这些步骤没有帮助

然后运行这个npm cache clean --force然后尝试重新安装你的包。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM