1、在VSCode用npm run dev运行项目时报错,报错信息如下:

aigov@aigov-PC MINGW64 /e/DevelopmentSoftware/aigov/xx (master)
$ npm install                                                       //添加包依赖 
npm WARN saveError ENOENT: no such file or directory, open 'E:\DevelopmentSoftware\aigov\xx\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 'E:\DevelopmentSoftware\aigov\xx\package.json'
npm WARN xx No description
npm WARN xx No repository field.
npm WARN xx No README data
npm WARN xx No license field.

up to date in 1.137s
found 0 vulnerabilities


aigov@aigov-PC MINGW64 /e/DevelopmentSoftware/aigov/xx (master)
$ npm run dev                                                        //开始运行项目
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path E:\DevelopmentSoftware\aigov\xx\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'E:\DevelopmentSoftware\aigov\xx\package.json'
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!     C:\Users\aigov\AppData\Roaming\npm-cache\_logs\2019-09-03T06_57_06_336Z-debug.log

2、原因:

报错原因是我没有进入到项目文件夹下进行npm install ,在项目文件夹外一层直接npm install去了。。导致项目没有真正添加包依赖,项目文件夹里也没有生成package.josn文件,所以找不到,然后报了上面的错。

3、解决:

先cd进入项目文件目录,再进行依赖包安装,最后再启动就没问题了。

Logo

前往低代码交流专区

更多推荐