解决npm ERR! code ENOENT npm ERR! syscall open npm ERR! path X:\RuoYi-Vue-master\RuoYi-Vue-master/pack

执行npm命令报错:

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path X:\RuoYi-Vue-master\RuoYi-Vue-master/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'X:\RuoYi-Vue-master\RuoYi-Vue-master\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

被自己蠢哭了,问题原因: 报错中已经说了 在xxxl路径下找不到 package.json文件,所以罪魁祸首就是执行npm命令的目录不对。
解决办法: 找到 package.json正确的目录,然后再在终端执行npm命令即可。

以自己为例,实际的路径如下:
解决npm ERR! code ENOENT npm ERR! syscall open npm ERR! path X:\RuoYi-Vue-master\RuoYi-Vue-master/pack_第1张图片
然后用这个路径在终端执行npm install 或npm run dev 都正常了:

解决npm ERR! code ENOENT npm ERR! syscall open npm ERR! path X:\RuoYi-Vue-master\RuoYi-Vue-master/pack_第2张图片

解决npm ERR! code ENOENT npm ERR! syscall open npm ERR! path X:\RuoYi-Vue-master\RuoYi-Vue-master/pack_第3张图片

你可能感兴趣的:(npm,vue.js,前端)