on a new Vue3 project made with the CLI tool, using the Default Vue3 Preview i end up with an error when i try to setup the i18n plugin.
Vue CLI v4.5.9
> Default (Vue 3 Preview) ([Vue 3] babel, eslint)
i added the plugin with the vue cli, letting all the default options and get the error:
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.
this is the full stdout
➜ hello-vue3 git:(master) vue add i18n
Installing vue-cli-plugin-i18n...
yarn add v1.16.0
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.1.3: The platform "linux" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
success Saved lockfile.
success Saved 10 new dependencies.
info Direct dependencies
└─ vue-cli-plugin-i18n@1.0.1
info All dependencies
├─ cli-table3@0.5.1
├─ colors@1.4.0
├─ deepmerge@4.2.2
├─ dot-object@1.9.0
├─ esm@3.2.25
├─ flat@5.0.2
├─ is-valid-glob@1.0.0
├─ vue-cli-plugin-i18n@1.0.1
├─ vue-i18n-extract@1.0.2
└─ vue-i18n@8.22.2
Done in 8.81s.
✔ Successfully installed plugin: vue-cli-plugin-i18n
? The locale of project localization. en
? The fallback locale of project localization. en
? The directory where store localization messages of project. It's stored under `src` directory. locales
? Enable locale messages in Single file components ? No
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 (/home/tykayn/.nvm/versions/node/v14.15.1/lib/node_modules/@vue/cli/node_modules/jscodeshift/src/Collection.js:213:13)
at injectOptions (/home/tykayn/.nvm/versions/node/v14.15.1/lib/node_modules/@vue/cli/lib/util/codemods/injectOptions.js:15:6)
at runTransformation (/home/tykayn/.nvm/versions/node/v14.15.1/lib/node_modules/@vue/cli/node_modules/vue-codemod/dist/src/run-transformation.js:61:17)
at /home/tykayn/.nvm/versions/node/v14.15.1/lib/node_modules/@vue/cli/lib/Generator.js:290:23
at Array.forEach (<anonymous>)
at Generator.resolveFiles (/home/tykayn/.nvm/versions/node/v14.15.1/lib/node_modules/@vue/cli/lib/Generator.js:276:24)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Generator.generate (/home/tykayn/.nvm/versions/node/v14.15.1/lib/node_modules/@vue/cli/lib/Generator.js:175:5)
at async runGenerator (/home/tykayn/.nvm/versions/node/v14.15.1/lib/node_modules/@vue/cli/lib/invoke.js:111:3)
at async invoke (/home/tykayn/.nvm/versions/node/v14.15.1/lib/node_modules/@vue/cli/lib/invoke.js:92:3)
i use node 14.15.1 with nvm.
and here is my package json:
{
"name": "hello-vue3",
"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"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0-0",
"vue-cli-plugin-i18n": "~1.0.1"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}