npm 错误!代码 ENOENT npm 错误!系统调用重命名

Atz*_*uki 5 javascript node.js npm

就像一周前一样,我通过命令 npm i -g path 安装了全局本地包。从今天开始一切正常。我尝试再次使用 npm i -g path 并收到此错误:

npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path "user"\AppData\Roaming\npm\node_modules\.staging\js2cp-28011c0d\node_modules\fs-extra
npm ERR! dest "user"\AppData\Roaming\npm\node_modules\.staging\fs-extra-d19736e5   
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, rename '"user"\AppData\Roaming\npm\node_modules\.staging\js2cp-28011c0d\node_modules\fs-extra' -> '"user"\AppData\Roaming\npm\node_modules\.staging\fs-extra-d19736e5'
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!     "user"\AppData\Roaming\npm-cache\_logs\2021-07-27T07_39_50_112Z-debug.log
Run Code Online (Sandbox Code Playgroud)

我想进入“user”\AppData\Roaming\npm\node_modules\ 但我无法在node_modules 文件夹中找到文件夹./.staging。

有什么想法导致此错误以及如何修复它吗?

ela*_* BA 11

你可以做一些事情来快速解决这个问题

A。清理缓存:npm cache clean --force

b. 删除package.lock

如果这两个对你没有帮助,你需要有点棘手

C。删除节点模块,然后再次 npm installe (希望这会有所帮助)

d. 使用 npm 删除节点并重新安装

大多数情况下,a 和 b 会为你解决问题!