首页 > 解决方案 > 在 WSL 上安装包时出现 EACCESS 错误

问题描述

我在尝试从 VS Code 对 WSL 上的 NPM INSTALL 包进行 NPM INSTALL 包时遇到此错误。

npm ERR! Error: EACCES: permission denied, rename '/mnt/d/DEVRepo/PWS/functions/node_modules/cssstyle' -> '/mnt/d/DEVRepo/PWS/functions/node_modules/.cssstyle.DELETE'
npm ERR!  [OperationalError: EACCES: permission denied, rename '/mnt/d/DEVRepo/PWS/functions/node_modules/cssstyle' -> '/mnt/d/DEVRepo/PWS/functions/node_modules/.cssstyle.DELETE'] {     
npm ERR!   cause: [Error: EACCES: permission denied, rename '/mnt/d/DEVRepo/PWS/functions/node_modules/cssstyle' -> '/mnt/d/DEVRepo/PWS/functions/node_modules/.cssstyle.DELETE'] {        
npm ERR!     errno: -13,
npm ERR!     code: 'EACCES',
npm ERR!     syscall: 'rename',
npm ERR!     path: '/mnt/d/DEVRepo/PWS/functions/node_modules/cssstyle',
npm ERR!     dest: '/mnt/d/DEVRepo/PWS/functions/node_modules/.cssstyle.DELETE'
npm ERR!   },
npm ERR!   stack: "Error: EACCES: permission denied, rename '/mnt/d/DEVRepo/PWS/functions/node_modules/cssstyle' -> '/mnt/d/DEVRepo/PWS/functions/node_modules/.cssstyle.DELETE'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'rename',
npm ERR!   path: '/mnt/d/DEVRepo/PWS/functions/node_modules/cssstyle',
npm ERR!   dest: '/mnt/d/DEVRepo/PWS/functions/node_modules/.cssstyle.DELETE',
npm ERR!   parent: 'functions'
npm ERR! }

标签: npmwindows-subsystem-for-linuxvscode-remote

解决方案


问题是 VSCode WSL 扩展锁定文件并产生错误。

解决方案是关闭 VSCode 上的 WSL 连接 o 只需关闭整个 IDE 并再次运行 npm install 命令。


推荐阅读