运行Vue项目时出现: no such file or directory, open 'D:\MyIDE\dianshang\package.json'
: no such file or directory, open 'D:\MyIDE\dianshang\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'D:\MyIDE\dianshang\package.json'
npm WARN dianshang No description
npm WARN dianshang No repository field.
npm WARN dianshang No README data
npm WARN dianshang No license field.
up to date in 2.781s
found 0 vulnerabilities
D:\MyIDE\dianshang>npm run serve
npm ERR! path D:\MyIDE\dianshang\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
回答:大概率是你的项目中没有 package.json,可以参考这篇文章看看:https://blog.csdn.net/CSDN_java1005/article/details/113119346
1、检查你npm run dev命令所在的文件位置,看看是不是 不在工程的根目录。
2、你工程中没有package.json
1.看报错信息就是没有进对文件夹
2.你可以重新创建一个文件夹,在新的文件夹加中跑npm i 试试
3.也可以试试cnpm