代码之家  ›  专栏  ›  技术社区  ›  Ezeeroc

我一直从npm得到“errno 4058”

  •  1
  • Ezeeroc  · 技术社区  · 6 年前

    在过去的几周里,我使用了npm,没有任何问题,但突然间,我不断地得到这个错误:

    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
    

    这是 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"
      }
    }
    

    问题是,当我手动安装一个包时也会发生这种情况。我做错什么了?谢谢

    编辑:当我在另一个目录上尝试时,手动安装就成功了。我不知道为什么。

    2 回复  |  直到 6 年前
        1
  •  6
  •   Sujeith Gopi Nath    6 年前

    我在macOS 10.12.6、Node 8.3.0、NPM 5.3.0上也遇到了同样的错误。它经常,但并不总是指 .DELETE . 它总是报告 ENOENT: no such file or directory

    快速修复: 删除package-lock.json并再次运行NPM

        2
  •  0
  •   PHPanchal    6 年前

    首先通过此命令检查端口是否正在运行

    lsof-i:8080//<-这是您使用的端口

    杀掉-914528/你的战俘身份证

    然后试着跑一次