vue.jsvuetify.jsvue-cli-4

Error: You cannot call "get" on a collection with no paths. Instead, check the "length" property first to verify at least 1 path exists


My CLI version is 4.5.8. I'm trying to install Vuetify but this error is showing up. Some please hep me to fix this error.

>vue add vuetify

�  Installing vue-cli-plugin-vuetify...

+ vue-cli-plugin-vuetify@2.0.7
updated 1 package in 27.591s

63 packages are looking for funding
  run `npm fund` for details

✔  Successfully installed plugin: vue-cli-plugin-vuetify

? Choose a preset: Default (recommended)

�  Invoking generator for vue-cli-plugin-vuetify...
 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 (C:\Program Files\nodejs\node_modules\@vue\cli\node_modules\jscodeshift\src\Collection.js:213:13)
    at injectOptions (C:\Program Files\nodejs\node_modules\@vue\cli\lib\util\codemods\injectOptions.js:15:6)
    at runTransformation (C:\Program Files\nodejs\node_modules\@vue\cli\node_modules\vue-codemod\dist\src\run-transformation.js:61:17)
    at C:\Program Files\nodejs\node_modules\@vue\cli\lib\Generator.js:290:23
    at Array.forEach (<anonymous>)
    at Generator.resolveFiles (C:\Program Files\nodejs\node_modules\@vue\cli\lib\Generator.js:276:24)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Generator.generate (C:\Program Files\nodejs\node_modules\@vue\cli\lib\Generator.js:175:5)
    at async runGenerator (C:\Program Files\nodejs\node_modules\@vue\cli\lib\invoke.js:111:3)
    at async invoke (C:\Program Files\nodejs\node_modules\@vue\cli\lib\invoke.js:92:3)

Solution

  • This error is caused by jscodeshift-powered script which aims to update instantiating Vue.js instance so it becomes aware of vuetify.

    I got this error when trying to add vuetify to a project with Vue.js v3. Unfortunately at the moment of writing vuetify does not support Vue.js v3 - https://vuetifyjs.com/en/introduction/roadmap/#v32e0-28titan29

    So if it's the case the only possible solution - is to switch to Vue.js v2