opentiny / tiny-vue

TinyVue is an enterprise-class UI component library of OpenTiny community, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.
https://opentiny.design/tiny-vue
MIT License
1.53k stars 251 forks source link

🐛 [Bug]: Vue packages version mismatch: #1773

Closed Snnerney closed 1 month ago

Snnerney commented 1 month ago

Version

opentiny-vue@3.14.0

Vue Version

"vue": "^3.4.23"

Link to minimal reproduction

D:\download-browser\tiny-vue-dev1\tiny-vue-dev\node_modules.pnpm\vue-template-compiler@2.6.14_vue@3.4.23typescript@5.5.4\node_modules\vue-template-compiler\index.js:10 throw new Error( ^

Error:

Vue packages version mismatch:

This may cause things to work incorrectly. Make sure to use the same version for both. If you are using vue-loader@>=10.0, simply update vue-template-compiler. If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest.

at Object.<anonymous> (D:\download-browser\tiny-vue-dev1\tiny-vue-dev\node_modules\.pnpm\vue-template-compiler@2.6.14_vue@3.4.23_typescript@5.5.4_\node_modules\vue-template-compiler\index.js:10:9)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Object.transformer (D:\download-browser\tiny-vue-dev1\tiny-vue-dev\node_modules\.pnpm\tsx@4.16.2\node_modules\tsx\dist\register-CCR7NebB.cjs:3:1101)  
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at require (node:internal/modules/cjs/helpers:103:18)
at props (d:\download-browser\tiny-vue-dev1\tiny-vue-dev\internals\vite-plugin-template2jsx\src\plugin.js:3:32)
at Object.<anonymous> (d:\download-browser\tiny-vue-dev1\tiny-vue-dev\internals\vite-plugin-template2jsx\src\plugin.js:13:44)
at Module._compile (node:internal/modules/cjs/loader:1159:14)

Node.js v18.12.0  ELIFECYCLE  Command failed with exit code 1.  ELIFECYCLE  Command failed with exit code 1.

Step to reproduce

从github上拉取dev分支代码进行pnpm i拉取依赖,使用pnpm dev运行出现以上错误,我试图删除node_modeules重新安装还是出现以上错误

What is expected

No response

What is actually happening

No response

What is your project name

TinyVue

Any additional comments (optional)

No response

Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


Title: 🐛 [Bug]:

Snnerney commented 1 month ago

机器人检测到问题正文的语言不是英语,并自动翻译。

标题: 🐛 [Bug]:

Pulling dev branch code from github to pnpm i to pull dependencies, running with pnpm dev I get the above error, I try to delete node_modeules reinstall still get the above error

kagol commented 1 month ago

@Noospic 你可以尝试在 internals/vite-plugin-template2jsx/package.json 中加上:

  "dependencies": {
    "lodash-es": "^4.17.21",
    "fs-extra": "^11.2.0",
++  "vue": "2.6.14",
    "vue-template-compiler": "2.6.14",
    "html-dom-parser": "~5.0.8"
  },

看下是否能解决问题?

我这边没有复现这个问题,但是看你发的报错信息,应该是 vite-plugin-template2jsx 这个子包中引入了 vue-template-compiler,这个依赖包的依赖里有一个 vue,这个 vue 是从上层目录找的,但是上层目录找不到。

  "devDependencies": {
    "vue": "file:../.."
  }
image

于是会继续引用更上层的 vue,就是根目录的 vue:

"vue": "^3.4.23"

但是根目录的 vue 版本号 3.4.23 和 vue-template-compiler 版本号 2.6.14 匹配不上,于是报了你截图的错误。

Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


@Noospic You can try adding: in internals/vite-plugin-template2jsx/package.json:

"dependencies": {
"lodash-es": "^4.17.21",
"fs-extra": "^11.2.0",
++ "vue": "2.6.14",
"vue-template-compiler": "2.6.14",
"html-dom-parser": "~5.0.8"
},

See if that solves the problem?