运行vue项目报错如下:
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\username\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open ‘C:\Users\username\package.json’
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

原因是没有进入到项目的目录,在执行命令的时候找不到package.json
所以要先进入到项目的目录里面
比如我的项目是在文件夹vueusing下,项目名为firstDemo
运行cd vueusing/firstDemo
再执行npm run dev即可

本文详细解析了在运行Vue项目时遇到的npm错误:ENOENT,无此文件或目录,无法找到package.json。错误原因是未进入项目目录,提供了解决方案:先进入项目目录,如cd vueusing/firstDemo,再执行npm run dev。
6621

被折叠的 条评论
为什么被折叠?



