簡體   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