3

I'm trying to run npm install for a little ember-driven site that I've got, but it throws the following error:

npm ERR! path /Projects/Etc/Admin/cuscus/node_modules/npm/node_modules/dezalgo
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/Projects/Etc/Admin/cuscus/node_modules/npm/node_modules/dezalgo' -> '/Projects/Etc/Admin/cuscus/node_modules/npm/node_modules/.dezalgo.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!     /Users/mick/.npm/_logs/2018-01-09T01_18_51_322Z-debug.log

If I delete the node_modules directory completely then run npm install again it seems to work, but running it again fails.

Mick Byrne
  • 14,394
  • 16
  • 76
  • 91

3 Answers3

4

What you can try is:

  1. Be sure that you use cmd promt in Admin mode.

  2. If you use VS Code, kill all node procceses. Close it and try again.

  3. Delete package-lock.json and node-modules folder and try again.
  4. Change the node version. For example try the old one v6.11.2
  5. Try to do npm cache clean --force
  6. Try to remove {package}.DELETE in ~/AppData/Roaming/npm/node_modules after the initial npm i -g {package} and retry npm i -g {package}

One of it can help. But not for sure. The status of issue with this problem is open for the moment. https://github.com/npm/npm/issues/17444

1

I just had this issue when setting up a new machine. None of the cache clean/uninstall/reinstall steps worked for me.

However, I was able to resolve it by updating npm to the latest version. I had 5.6.0 installed, but using npm-windows-upgrade to install the latest version (5.7.1) cleared up the dependency issues.

See this answer for more information on upgrading npm on Windows: https://stackoverflow.com/a/31520672/91189

Joseph Gabriel
  • 8,339
  • 3
  • 39
  • 53
1

This most likely happened because you updated your node version and because you probably already had this repo sitting on your machine before that particular update, the package-lock.json file whose sole purpose is to track the present and past state of your node_modules file and maintain a very updated dependency tree such that amongst entities using your code there will be consistency installing exactly the same dependencies ;

Entities using your code include

  1. Teammates

  2. Deployments (AWS ECS),

  3. and Continuous integration tools like Travis CI that are running your code,

Try to delete the package-lock.json file. Run the npm install command and you should be fine.

The last thing you should try doing is deleting the missing package if you are not sure of what you are doing, it's usually better to avoid this.

Goodluck.