出現(xiàn)如下問題:
You cannot call "get" on a collection with no paths. Instead, check the "length" property first to verify at least 1 path exists. 報錯詳情如下:
.......
?? 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:\Users\aa\AppData\Local\Yarn\Data\global\node_modules\jscodeshift\src\Collection.js:213:13)
at injectOptions (C:\Users\aa\AppData\Local\Yarn\Data\global\node_modules\@vue\cli\lib\util\codemods\injectOptions.js:15:6)
at runTransformation (C:\Users\aa\AppData\Local\Yarn\Data\global\node_modules\vue-codemod\dist\src\run-transformation.js:61:17)
at Object.keys.forEach.file (C:\Users\aa\AppData\Local\Yarn\Data\global\node_modules\@vue\cli\lib\Generator.js:290:23)
at Array.forEach (<anonymous>)
at Generator.resolveFiles (C:\Users\aa\AppData\Local\Yarn\Data\global\node_modules\@vue\cli\lib\Generator.js:276:24)
at process._tickCallback (internal/process/next_tick.js:68:7)
//main.js 默認代碼
import { createApp } from 'vue'
import App from './App.vue'
createApp(App).mount('#app')
//為了順利利用vue add vuetify命令進行安裝,,需要在輸入命令之前更改main.js代碼
//main.js 更改后代碼
import Vue from 'vue'
import App from './App.vue'
new Vue({
render: h => h(App)
}).$mount('#app');
對 main.js 進行如上的更改后,,再運行 vue add vuetify 即可順利安裝。
之所以會出現(xiàn)這個問題,,是因為當前 Vue 3.0 發(fā)布不久,,vuetify 對 Vue 3.0 的語法沒有做適配更新,只能使用 Vue 2.0 的語法,。當然,,如果你使用的是 Vue 2.0 創(chuàng)建的項目,那么就不會存在這個問題,。
參考鏈接如下:
https://github.com/vuetifyjs/vue-cli-plugins/issues/140
本作品采用《CC 協(xié)議》,,轉(zhuǎn)載必須注明作者和本文鏈接
|