1.问题一
在我们启动项目前通常要先安装node_modules依赖包,但是很多时候npm install命令行并不能一次安装成功,并且还会报错下面这个错误

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2020-11-23T01_28_17_030Z-debug.log

解决方法

先删除node_modle文件,清除缓存

npm cache clean --force

然后安装淘宝镜像

npm install -g cnpm --registry=https://registry.npm.taobao.org   

再重新下载安装包

cnpm i

2.问题二
执行npm install 出现如下提醒

added 253 packages from 162 contributors and audited 1117 packages in 42.157s
found 5 vulnerabilities (1 low, 4 high)
run `npm audit fix` to fix them, or `npm audit` for details html

按照控制台提示的命令,输入‘npm audit fix’后,控制台提示:

1 package update for 5 vulns involved breaking changes
  (use `npm audit fix --force` to install breaking changes; or do it by hand)

这个时候不要再去修复了,直接npm run dev 运行项目,我之前强行修复后又会出来新的错误提示,“webpack-dev-server” "webpack”版本冲突,我猜测应该是force强行更新了"webpack"的版本,如果已经出现这个错误,那么建议删除项目,从头开始npm install

Logo

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

更多推荐