Can't install NPM dependencies on Windows 10

Marc Bosse picture Marc Bosse · Feb 14, 2018 · Viewed 9.6k times · Source

Not too sure what's changed with Node.js and NPM recently (i.e. in the last several days) but I can't seem to find a way to install node_modules dependencies for any projects using Node.js on Windows 10 anymore...

My current setup is as follows:

Node.js: v9.5.0 NPM: v5.6.0 Vue.js: v2.9.3

I've tried clearing the cache prior to install: npm cache clear -f

Any time I attempt to run npm i or npm install I'm presented with the following list of errors:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents): 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules\.staging\fsevents-a6c1bd51\node_modules\abbrev' -> 'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules\.staging\abbrev-3ab84c45'

npm ERR! path C:\xampp\htdocs\vue-scrolling-table-sample\node_modules\acorn
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules\acorn' -> 'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules\.acorn.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\mbosse\AppData\Roaming\npm-cache\_logs\2018-02-14T18_27_56_988Z-debug.log

The specified debug.log contains the follow:

19859 warn optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):

19860 warn optional SKIPPING OPTIONAL DEPENDENCY: Error: EPERM: operation not permitted, rename'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules.staging\fsevents-a6c1bd51\node_modules\abbrev' -> 'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules.staging\abbrev-3ab84c45'

19861 verbose optional SKIPPING OPTIONAL DEPENDENCY:

19861 verbose optional Please try running this command again as root/Administrator.

19862 verbose stack Error: ENOENT: no such file or directory, rename 'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules\acorn' -> 'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules.acorn.DELETE'

19863 verbose cwd C:\xampp\htdocs\vue-scrolling-table-sample

19864 verbose Windows_NT 10.0.14393

19865 verbose argv "C:\ProgramFiles\nodejs\node.exe" "C:\ProgramFiles\nodejs\node_modules\npm\bin\npm-cli.js" "i"

19866 verbose node v9.5.0

19867 verbose npm v5.6.0

19868 error path C:\xampp\htdocs\vue-scrolling-table-sample\node_modules\acorn

19869 error code ENOENT

19870 error errno -4058

19871 error syscall rename

19872 error enoent ENOENT: no such file or directory, rename 'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules\acorn' -> 'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules.acorn.DELETE'

19873 error enoent This is related to npm not being able to find a file.

19874 verbose exit [ -4058, true ]

So it seems, for some reason, NPM is incapable of renaming node_modules dependencies. I've tried rolling back NPM to earlier version (in case npm@latest is not stable enough).

Using nvm I've completely uninstalled all versions of Node.js and NPM and reinstalled them. I've since tried installing my dependencies on a Node.js v6.11.3 setup as well as a Node.js v8.9.4 with the identical outcome.

Any suggestions would be very beneficial, thank you!

Answer

IronMusk picture IronMusk · Aug 13, 2019

Possible duplicate => npm ERR! Error: EPERM: operation not permitted, rename

Steps:

  1. npm cache clean --force
  2. npm install

If and only IF this doesn't work what I did was erasing the node_modules folder and package-lock.json (if you have the last one) and repeat steps 1 and 2