最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - npm ERR! code ENOENT npm ERR! syscall rename - Stack Overflow

programmeradmin1浏览0评论

Like week ago I installed local package globaly by command npm i -g path. It worked fine since today. I tried to use npm i -g path again and i get this error:

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

I wanted to go into "user"\AppData\Roaming\npm\node_modules\ but I cant find folder ./.staging inside the node_modules folder.

Any ideas what's causing this error and how to fix it?

Like week ago I installed local package globaly by command npm i -g path. It worked fine since today. I tried to use npm i -g path again and i get this error:

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

I wanted to go into "user"\AppData\Roaming\npm\node_modules\ but I cant find folder ./.staging inside the node_modules folder.

Any ideas what's causing this error and how to fix it?

Share Improve this question asked Jul 27, 2021 at 7:47 AtzukiAtzuki 8671 gold badge7 silver badges17 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 13

you can do couple things to fix this quickly

a. clean cache: npm cache clean --force

b. delete package.lock

if those two doesnt help youl need to be a bit tricky

c. delete node-modules and then npm install againe (hope this will help)

d. delete node with npm and reinstall it

mostly the a and b will solve the problem for ya!

For me, I was accidentally using node 14, while node 16 was the one I was working with before. After switching to node 16 again the problem was resolved. Might be worth a check before reinstalling node.

i just simply removed node_modules directory and enter

npm i 

work for me

发布评论

评论列表(0)

  1. 暂无评论