错误:您不能在没有路径的集合上调用“获取”相反,请首先检查“长度”属性以验证至少存在1条路径

问题描述

我的CLI版本是4.5.8。 我正在尝试安装Vuetify,但出现此错误。 有人请帮助我解决错误

>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)

解决方法

此错误是由 jscodeshift 驱动的脚本引起的,该脚本旨在更新实例化 Vue.js 实例,使其意识到 vuetify。

我在尝试将 vuetify 添加到使用 Vue.js v3 的项目时遇到此错误。 不幸的是,在撰写本文时 vuetify 不支持 Vue.js v3 - https://vuetifyjs.com/en/introduction/roadmap/#v32e0-28titan29

因此,如果是这种情况,唯一可能的解决方案是切换到 Vue.js v2

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...