问题一
一、使用Vue脚手架创建项目时:ERROR Failed to get response from https://registry.npmjs.org/vue-cli-version-marker
Vue CLI v4.5.8
✨ Creating project in F:\Vue项目\vue的b站教程\vuejs资料和代码\Day 09\课堂代码\LearnVuejs09\exermall.
⚙️ Installing CLI plugins. This might take a while...
npm ERR! Unexpected end of JSON input while parsing near '...1\nNEKLkDOnmTxsFd/3rV'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2020-11-13T12_45_04_295Z-debug.log
ERROR command failed: npm install --loglevel error
F:\Vue项目\vue的b站教程\vuejs资料和代码\Day 09\课堂代码\LearnVuejs09>vue create exermall
ERROR Failed to get response from https://registry.npmjs.org/vue-cli-version-marker
- 方法:vue create exermall -r https://registry.npm.taobao.org
我使用无效但是可以尝试的方法
①强制清除缓存 npm cache clean --force 后再创建项目
②修改系统盘的配置:
将这个文件C:\Users\Administrator.vuerc的 “useTaobaoRegistry” 改为false,
二、npm run serve的时候只能加载到98%就卡住
- 原因:因为代码中有一个import导入的地方为空
- 解决办法:完善代码即可
三、突然报错,缺少某个核心
- 原因:使用快捷键,vscode自动添加了导入语句,导致编译找不到对应的依赖
- 解决方法:删除因使用快捷键造成的多余引用
四、运行项目后提示C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2020-11-28T10_25_45_847Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mysupermall@0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mysupermall@0.1.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2020-11-28T10_25_45_847Z-debug.log**
- 原因分析:项目的相关配置重复了,网上查答案,清理缓存没用;卸载安装包后直接运行项目也会造成此问题(卸载eslint)。
- 解决方法:
1、运行项目的时候不要打开其他项目文件;
2、查找重复的配置,一般是webpack的配置和node_modules里面的配置有重复;
3、重新安装之前卸载的包。
五、创建项目出现:ERROR Failed to get response from http://registry.npmjs.org/vue-cli-version-marker
F:\Vue项目-饿了么>vue create vue-elmmall
ERROR Failed to get response from http://registry.npmjs.org/vue-cli-version-marker
Vue CLI v4.5.8
Failed to check for updates
- 原因分析:应该和使用淘宝镜像安装npm有关,具体原因待解决
- 解决方法:使用问题一的命令可解决。
六、安装相关包卡了,使用git的一些指令,重新安装后出现的问题:
F:\Vue项目-饿了么\elmshop>vue add cube-ui
� Installing vue-cli-plugin-cube-ui...
npm ERR! Unexpected end of JSON input while parsing near '...ugin","version":"0.2.'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2020-12-09T15_11_25_461Z-debug.log
ERROR command failed: npm install --loglevel error vue-cli-plugin-cube-ui -D
- 解决方法:使用问题一的方法解决了。