官方脚手架demo npm安装方式无法运行
相关平台
微信小程序
小程序基础库: 3.5.5 使用框架: Vue 3
复现步骤
1.安装taro4.0.6 2.新建Vue3 JavaScript Npm Vite Github vue3-NutUI 3.npm install安装依赖 依赖冲突报错
期望结果
npm和yarn都能正常运行demo
实际结果
yarn可以正常装包运行demo,npm装包依赖冲突无法运行
环境信息
Taro CLI 4.0.6 environment info:
System:
OS: macOS 15.0
Shell: 3.2.57 - /bin/sh
Binaries:
Node: 22.9.0 - /usr/local/bin/node
Yarn: 1.22.22 - /usr/local/bin/yarn
npm: 10.9.0 - /usr/local/bin/npm
npmPackages:
@tarojs/cli: 4.0.6 => 4.0.6
@tarojs/components: 4.0.6 => 4.0.6
@tarojs/helper: 4.0.6 => 4.0.6
@tarojs/plugin-framework-vue3: 4.0.6 => 4.0.6
@tarojs/plugin-html: 4.0.6 => 4.0.6
@tarojs/plugin-platform-alipay: 4.0.6 => 4.0.6
@tarojs/plugin-platform-h5: 4.0.6 => 4.0.6
@tarojs/plugin-platform-jd: 4.0.6 => 4.0.6
@tarojs/plugin-platform-qq: 4.0.6 => 4.0.6
@tarojs/plugin-platform-swan: 4.0.6 => 4.0.6
@tarojs/plugin-platform-tt: 4.0.6 => 4.0.6
@tarojs/plugin-platform-weapp: 4.0.6 => 4.0.6
@tarojs/runtime: 4.0.6 => 4.0.6
@tarojs/shared: 4.0.6 => 4.0.6
@tarojs/taro: 4.0.6 => 4.0.6
@tarojs/vite-runner: 4.0.6 => 4.0.6
babel-preset-taro: 4.0.6 => 4.0.6
eslint-config-taro: 4.0.6 => 4.0.6
遇到同样问题
我也是一样的问题
可以的话列下具体报错信息?
通过taro init demo初始化项目,选择如下:

报错如下,@tarojs/plugin-framework-vue3需要 @vitejs/plugin-vue 的5.x版本。
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: @tarojs/[email protected]
npm error Found: @vitejs/[email protected]
npm error node_modules/@vitejs/plugin-vue
npm error dev @vitejs/plugin-vue@"^4.0.0" from the root project
npm error
npm error Could not resolve dependency:
npm error peerOptional @vitejs/plugin-vue@"^5" from @tarojs/[email protected]
npm error node_modules/@tarojs/plugin-framework-vue3
npm error @tarojs/plugin-framework-vue3@"4.0.6" from the root project
npm error
npm error Conflicting peer dependency: @vitejs/[email protected]
npm error node_modules/@vitejs/plugin-vue
npm error peerOptional @vitejs/plugin-vue@"^5" from @tarojs/[email protected]
npm error node_modules/@tarojs/plugin-framework-vue3
npm error @tarojs/plugin-framework-vue3@"4.0.6" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
尝试升级 @vitejs/plugin-vue 5.x, 报错vite版本与 @vitejs/plugin-vue 5.x冲突。
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: [email protected]
npm error Found: [email protected]
npm error node_modules/vite
npm error dev vite@"^4.2.0" from the root project
npm error
npm error Could not resolve dependency:
npm error peer vite@"^5.0.0" from @vitejs/[email protected]
npm error node_modules/@vitejs/plugin-vue
npm error dev @vitejs/plugin-vue@"^5" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
找到了以前的相同问题,issue #16303,3个月前的bug了。
心真累啊,我也跑不起来,,vue3 + ts + nutui + vite,,已放弃了
是的,感觉官方不太上心了,连官方脚手架项目都运行不起来,处理的奇慢无比
一样,服了,最基础的初始化项目都不行
同样的问题,有解决方案了嘛
我解决了,已经给官方提pr了,本地可先用 npm i --legacy-peer-deps 方式安装依赖,让项目正常跑起来