当我尝试 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)
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"
}
}
vue create
到目前为止,我使用并安装了 tailwindcss 和 postcss 设置了项目。
你能描述一下,这个错误的真正含义是什么?我想它与 i18n 无关,但在我使用时也会与其他模块一起发生add
npm install vue-i18n
作品(仅供参考)
附加问题
如何在 vuejs 3.0 中设置 i18n?vuejs2 和 3 的区别在哪里?