hel*_*lle 6 vue.js vue-i18n vuejs3 vue-cli-4
当我尝试 vue add i18n 时,我正在运行此错误:
Invoking generator for vue-cli-plugin-i18n...
ERROR Error: You cannot call "get" on a collection with no paths. Instead, check the "length" property first to verify at least 1 path exists.
Error: You cannot call "get" on a collection with no paths. Instead, check the "length" property first to verify at least 1 path exists.
at Collection.get (/usr/local/lib/node_modules/@vue/cli/node_modules/jscodeshift/src/Collection.js:213:13)
at injectOptions (/usr/local/lib/node_modules/@vue/cli/lib/util/codemods/injectOptions.js:15:6)
at runTransformation (/usr/local/lib/node_modules/@vue/cli/node_modules/vue-codemod/dist/src/run-transformation.js:61:17)
at Object.keys.forEach.file (/usr/local/lib/node_modules/@vue/cli/lib/Generator.js:290:23)
at Array.forEach (<anonymous>)
at Generator.resolveFiles (/usr/local/lib/node_modules/@vue/cli/lib/Generator.js:276:24)
at process._tickCallback (internal/process/next_tick.js:68:7)
Run Code Online (Sandbox Code Playgroud)
vue add 命令之前的 package.json 如下所示:
{
"name": "com.food-cheatsheet",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.6.5",
"vue": "^3.0.0-0",
"vue-router": "^4.0.0-0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0-0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0-0",
"tailwindcss": "^1.7.5"
}
}
Run Code Online (Sandbox Code Playgroud)
vue create到目前为止,我使用并安装了 tailwindcss 和 postcss 来设置项目。
你能描述一下,这个错误究竟意味着什么?我想它与 i18n 无关,但也会与其他模块一起出现,当我使用时add
npm install vue-i18n 作品(仅供参考)附加问题
如何在 vuejs 3.0 中设置 i18n?vuejs2 和 3 的区别在哪里?
vuetifyjs 存在同样的问题https://github.com/vuetifyjs/vue-cli-plugins/issues/140
对于 vue 3
npm install --save vue-i18n@next
yarn add vue-i18n@next
Run Code Online (Sandbox Code Playgroud)
并手动配置 i18n
来自 vue-i18n-next 的示例:
如果你想安装vue add i18n更改
createApp(App)
.use(store)
.use(router)
.mount("#app");
Run Code Online (Sandbox Code Playgroud)
到
new Vue({
router,
store,
render: h => h(App)
}).$mount("#app");
Run Code Online (Sandbox Code Playgroud)
对于打字稿项目添加 vue-i18n.d.ts 文件,内容是
declare module "vue-i18n"
Run Code Online (Sandbox Code Playgroud)
对于 vue 3 我安装npm install --save vue-i18n@next而不是vue add i18n
| 归档时间: |
|
| 查看次数: |
1312 次 |
| 最近记录: |