安装 vue-i18n 导致 vite 报错。

huangapple go评论92阅读模式
英文:

Installing vue-i18n causing error with vite

问题

Trying to install vue-i18n with no luck, please see my error below

npm install vue-i18n
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: MPS@undefined
npm ERR! Found: vue@2.7.14
npm ERR! node_modules/vue
npm ERR! dev vue@^2.6.12 from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue@^3.0.0 from vue-i18n@9.2.2
npm ERR! node_modules/vue-i18n
npm ERR! vue-i18n@* from the root project
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!
npm ERR! For a full report see:
npm ERR! /Users/yohanesai/.npm/_logs/2023-05-24T17_16_32_468Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/yohanesai/.npm/_logs/2023-05-24T17_16_32_468Z-debug-0.log

Have tried with --legacy-peer-deps, I can install it but when trying to npm run dev, it becomes more problematic, with more errors. So, I think the error is important, and I can't avoid it. This is the error I encounter if I insist on installing Vue i18n:

Error: Build failed with 3 errors:
../../node_modules/vue-i18n/dist/vue-i18n.esm-bundler.js:8:9: ERROR: No matching export in "../../../node_modules/vue/dist/vue.runtime.esm.js" for import "createVNode"
../../node_modules/vue-i18n/dist/vue-i18n.esm-bundler.js:8:22: ERROR: No matching export in "../../../node_modules/vue/dist/vue.runtime.esm.js" for import "Text"
../../node_modules/vue-i18n/dist/vue-i18n.esm-bundler.js:8:70: ERROR: No matching export in "../../../node_modules/vue/dist/vue.runtime.esm.js" for import "Fragment"

What did I miss here? I am using node v19.8.1 and npm 9.5.1.

英文:

Trying to install vue-i18n with no luck, please see my error bellow

npm install vue-i18n
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: MPS@undefined
npm ERR! Found: vue@2.7.14
npm ERR! node_modules/vue
npm ERR!   dev vue@"^2.6.12" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"^3.0.0" from vue-i18n@9.2.2
npm ERR! node_modules/vue-i18n
npm ERR!   vue-i18n@"*" from the root project
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! 
npm ERR! For a full report see:
npm ERR! /Users/yohanesai/.npm/_logs/2023-05-24T17_16_32_468Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/yohanesai/.npm/_logs/2023-05-24T17_16_32_468Z-debug-0.log

Have try with --legacy-peer-deps, I can install it but when trying to npm run dev is going to more crazy, (more error). So I think the error is important and I can't avoid the error. This is the error if I insist to install the vue i18n

Error: Build failed with 3 errors:
../../node_modules/vue-i18n/dist/vue-i18n.esm-bundler.js:8:9: ERROR: No matching export in "../../../node_modules/vue/dist/vue.runtime.esm.js" for import "createVNode"
../../node_modules/vue-i18n/dist/vue-i18n.esm-bundler.js:8:22: ERROR: No matching export in "../../../node_modules/vue/dist/vue.runtime.esm.js" for import "Text"
../../node_modules/vue-i18n/dist/vue-i18n.esm-bundler.js:8:70: ERROR: No matching export in "../../../node_modules/vue/dist/vue.runtime.esm.js" for import "Fragment"

What I missed here? I use node v19.8.1 and npm 9.5.1

答案1

得分: 0

这是一个库版本依赖错误,在这种情况下,您正在使用Vue 2,而vue-i18n@9.2.2需要Vue 3,因此您需要将Vue 2升级到Vue 3(可能会破坏您的实际代码),或者将vue-i18n降级到8.x

英文:

This is a lib version dependency error, in this case you are using Vue 2, and vue-i18n@9.2.2 needs Vue3, so you need upgrade Vue2 to Vue3(maybe i will brake your actual code) or downgrade vue-i18n to 8.x

huangapple
  • 本文由 发表于 2023年5月25日 01:43:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/76326162.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定