ENOENT: no such file or directory, lstat 'C:\Users\33612\AppData\Roaming\npm'
2023-11-05 2108 0
更新完Node.js后,执行npm命令报错了:
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:\Users\33612\AppData\Roaming\npm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\33612\AppData\Roaming\npm'
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: C:\Users\33612\AppData\Local\npm-cache\_logs\2023-11-04T22_16_32_378Z-debug-0.log

解决方法也是很简单,复制Error里的文件路径:C:\Users\33612\AppData\Roaming\,在这个文件夹里创建一个空的npm文件夹就可以了。
我在执行npx create-next-app@latest创建react app就不会报错了。