vue项目Error: Cannot find module ‘xxx’类报错的解决方法
现发现只要是报错 Error: Cannot find module ‘xxx’(例如 Error: Cannot find module ‘webpack’)这类的问题都可以用下面的方法解决。报错内容如下:运行 npm install 没问题,运行 npm run serve 就会报错:Error: Cannot find module ‘webpack’解决方案:到项目文件夹下,删除node_
现发现只要是报错 Error: Cannot find module ‘xxx’(例如 Error: Cannot find module ‘webpack’)这类的问题都可以用下面的方法解决。
报错内容如下:
运行 npm install 没问题,运行 npm run serve 就会报错:
Error: Cannot find module ‘webpack’
解决方案:
- 到项目文件夹下,删除 node_modules 文件和 package-lock.json 文件。注意不是package.json(如果删不掉,看下项目是不是打开了,关了再试试)
- 在项目下运行npm install
- 继续运行npm run dev(这里不一定是dev,要根据自己实际项目中的配置来,就是启动项目就行)
后面如果报需要安装什么插件,再继续安装插件,重启即可。一定要删除 package-lock.json 不然没有效果!!
安装依赖时错误:fatal: repository ‘https://github.com/nhn/raphael.git/’ not found
vue项目 npm i 安装依赖失败
npm ERR! Error while executing:
npm ERR! d:\Git\cmd\git.EXE ls-remote -h -t https://github.com/nhn/raphael.git
npm ERR! fatal: unable to access 'https://github.com/nhn/raphael.git/': OpenSSL SSL_read: Connection was reset, errno 10054
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\glq\AppData\Roaming\npm-cache\_logs\2021-08-05T01_57_51_837Z-debug.log
解决方案 1:
当前网络无法访问 github.com ,建议切换为手机热点网络。
解决方案 2:
1、配置淘宝镜像
npm install --registry=https://registry.npm.taobao.org //单次使用
npm config set registry https://registry.npm.taobao.org //永远使用
配置完成后检验是否成功:
npm config get registry //或者下一行
npm info express//或者上一行
2、再次安装
npm i
注意:如果想还原 npm 仓库地址,只需再把地址配置成 npm 镜像就可以了
npm config set registry https://registry.npmjs.org/
参考链接:
cls-remote -h -t https://github.com/nhn/raphael.git npm ERR! fatal: unable to access ‘https://github._oduok的博客-CSDN博客
原文链接:https://blog.csdn.net/sinat_19319243/article/details/119409922
vue项目Error: Cannot find module ‘xxx’类报错的解决方法_晴天'的博客-CSDN博客_cannot find module vue
原文链接:https://blog.csdn.net/weixin_42216142/article/details/87191352
更多推荐
所有评论(0)