在运行 vue create web 指令时出现npm错误
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
| added 1345 packages in 58s
� Invoking generators...
� Installing additional dependencies...
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: vue@2.6.12
npm ERR! node_modules/vue
npm ERR! vue@"^2.6.11" from the root project
npm ERR! peer vue@"^2 || ^3.0.0-0" from @vue/babel-preset-app@4.5.13
npm ERR! node_modules/@vue/babel-preset-app
npm ERR! @vue/babel-preset-app@"^4.5.13" from @vue/cli-plugin-babel@4.5.13
npm ERR! node_modules/@vue/cli-plugin-babel
npm ERR! dev @vue/cli-plugin-babel@"^4.5.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"3.0.11" from @vue/compiler-sfc@3.0.11
npm ERR! node_modules/@vue/compiler-sfc
npm ERR! peer @vue/compiler-sfc@"^3.0.0-beta.14" from @vue/cli-service@4.5.13
npm ERR! node_modules/@vue/cli-service
npm ERR! dev @vue/cli-service@"^4.5.0" from the root project
npm ERR! 4 more (@vue/cli-plugin-babel, @vue/cli-plugin-eslint, ...)
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\TANG\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\TANG\AppData\Local\npm-cache\_logs\2021-05-16T13_14_25_524Z-debug.log
ERROR command failed: npm install --loglevel error --registry=https://registry.npm.taobao.org/ --registry=https://registry.npm.taobao.org/
|
按照提示操作不起作用
重新安装vue-cli
卸载旧版本vue-cli
1
| npm uninstall -g vue-cli
|
卸载时出现问题
需要检查C:\Users\用户\.npmrc文件,删除以下代码
cache=C:\Program Files\nodejs\node_cache
prefix=C:\Program Files\nodejs\node_global
安装新版本vue-cli
1
| npm install -g @vue/cli
|
再次创建项目
如若内容有不足之处,还望大家多提建议多多与我交流。
更多精彩可以关注我的博客https://johntunliu.gitee.io/或微信公众号LiuJohntun,记录并分享我的所见、所学、所想…