2

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: fsevents@1.1.3 (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: fsevents@1.1.3 (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!

Marc Bosse
  • 336
  • 1
  • 3
  • 17
  • 1
    Many tutorials say this happens due to race-conditions and running `npm install` multiple times eventually resolves the issue. This isn't the case as it's always the same module that fails, never getting any further in the dependency install process. – Marc Bosse Feb 14 '18 at 19:07
  • 1
    Try `yarn`, it often works better in windows environment. – Egor Stambakio Feb 14 '18 at 19:11
  • Part of me is just curious if anyone else is experiencing this issue! Honestly been thinking about setting up a Linux Mint OS on a bootable USB drive. That way I can always develop in a Linux environment where permissions make more sense. – Marc Bosse Feb 14 '18 at 19:19
  • @wostex, I've tried following your suggestion. Now using yarn on my project which seems to generate the `node_modules` and `.lock` file correctly for all but my forked dependency. – Marc Bosse Feb 14 '18 at 20:11

2 Answers2

3

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

F94Olivera
  • 31
  • 3
0

If possibly you have renamed your package.json and the name does not match your package-lock.json

To resolve this error open your package.json and package-lock.json to check if the "name" key has the same value.

If not change then change them to match your project name.

Example if your project name is todo-list then the "name" value can be todo-list. Note, this is not compulsory.