WSL中使用npm install報錯


報錯內容類似下面的格式。具體解決方法請看這里:https://github.com/Microsoft/WSL/issues/14
着重關注 https://github.com/Microsoft/WSL/issues/14#issuecomment-207504657https://github.com/Microsoft/WSL/issues/14#issuecomment-514342783

以前記錄這種踩坑的文章,純粹是把原文的解決方法粘過來。以后如果沒有原創內容,直接貼鏈接和報錯提示,方便來訪的讀者。

➜  * git:(master) ✗ npm install
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /home/*/Project/*/node_modules/array-sort
npm ERR! dest /home/*/Project/*/node_modules/.array-sort.DELETE
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/home/*/Project/*/node_modules/array-sort' -> '/home/*/Project/*/node_modules/.array-sort.DELETE'
npm ERR!  [OperationalError: EACCES: permission denied, rename '/home/*/Project/*/node_modules/array-sort' -> '/home/*/Project/*/node_modules/.array-sort.DELETE'] {
npm ERR!   cause: [Error: EACCES: permission denied, rename '/home/*/Project/*/node_modules/array-sort' -> '/home/*/Project/*/node_modules/.array-sort.DELETE'] {
npm ERR!     errno: -13,
npm ERR!     code: 'EACCES',
npm ERR!     syscall: 'rename',
npm ERR!     path: '/home/*/Project/*/node_modules/array-sort',
npm ERR!     dest: '/home/*/Project/*/node_modules/.array-sort.DELETE'
npm ERR!   },
npm ERR!   stack: "Error: EACCES: permission denied, rename '/home/*/Project/*/node_modules/array-sort' -> '/home/*/Project/*/node_modules/.array-sort.DELETE'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'rename',
npm ERR!   path: '/home/*/Project/*/node_modules/array-sort',
npm ERR!   dest: '/home/*/Project/*/node_modules/.array-sort.DELETE',
npm ERR!   parent: 'MyIP'
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!     /home/*/.npm/_logs/2019-12-24T05_53_16_578Z-debug.log


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM