I keep getting `errno 4058` from npm

Coreeze picture Coreeze · Aug 13, 2018 · Viewed 9.7k times · Source

I used npm in the last weeks without any problems, but all of the sudden i keep getting this error:

npm ERR! path J:\Work\Web_server\create_file\node_modules\depd
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'J:\Work\Web_server\create_file\node_modules\depd' -> 'J:\Work\Web_server\create_file\node_modules\.depd.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\crist\AppData\Roaming\npm-cache\_logs\2018-08-13T09_21_56_509Z-debug.log

This is the package.json:

{
  "name": "create_file",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies":{

  },
  "devDependencies":{
    "express": "4.16.3"
  }
}

The thing is, it also happens when I manually install a package. What am I doing wrong? Thanks

Edit: And when I tried it on a different directory the manual installation worked. I have no idea why.

Answer

Sujeith Gopi Nath picture Sujeith Gopi Nath · Aug 13, 2018

I faced the same error on macOS 10.12.6, Node 8.3.0, NPM 5.3.0. It often, but not always is referring to .DELETE. It does always report ENOENT: no such file or directory

There are no other Node processes running. I closed Visual Studio Code, still seeing ENOENT.

QuickFix: Delete package-lock.json and run NPM again