npmwindows-subsystem-for-linuxvscode-remote

EACCESS error when installing packages on WSL


I'm getting this error trying to NPM INSTALL packages on WSL from VS Code.

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! }

Solution

  • The problem is that VSCode WSL extension locks files and that generates the error.

    The solution is to close the WSL connection on VSCode o just close the whole IDE and run the npm install command again.