解决Vue报错unable to resolve dependency tree

 目录

一、问题

1.1 问题描述

二、解决

2.1 解决


一、问题

1.1 问题描述

今天在新创建一个项目,也就是在空文件夹里执行Vue脚手架的创建代码,如下

vue create 项目名称

没想到创建报错了:ERESOLVE unable to resolve dependency tree,具体报错的内容如下

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: [email protected]
npm ERR! node_modules/vue
npm ERR!   vue@"^3.0.0" from the root project
npm ERR!   peerOptional vue@"^2 || ^3.0.0-0" from @vue/[email protected]
npm ERR!   node_modules/@vue/babel-preset-app
npm ERR!     @vue/babel-preset-app@"^4.5.19" from @vue/[email protected]
npm ERR!     node_modules/@vue/cli-plugin-babel
npm ERR!       dev @vue/cli-plugin-babel@"~4.5.4" from the root project
npm ERR!   3 more (@vue/babel-preset-jsx, @vue/cli-plugin-typescript, vue-jest)

这就有点莫名其妙了,脚手架创建竟然报错了....... 

二、解决

2.1 解决

根据错误稍微查了下,发现造成这个问题的原因可能是由于 node版本不契合导致的,这时我突然想起来前段时间我把node切换到了18,确实有可能是这个引起的

 把版本切回到14,再执行 vue create 项目名称,这次项目正常创建,没有任何异常错误出现

 问题完美解决......特此记录一下供有需要的朋友查询~

猜你喜欢

转载自blog.csdn.net/zy21131437/article/details/131882544
今日推荐