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进入项目文件目录,再进行依赖包安装,最后再启动就没问题了。

GitHub 加速计划 / js / json
41.72 K
6.61 K
下载
适用于现代 C++ 的 JSON。
最近提交(Master分支:1 个月前 )
960b763e 3 个月前
8c391e04 6 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐