【トラブル】【Vue】Vuetify に関するトラブルシューティング

■ はじめに

https://dk521123.hatenablog.com/entry/2020/12/26/000242

などで発生した Vuetify に関する
トラブルシューティングについて、まとめる

目次

【1】「vue add vuetify」実行時の警告
【2】「npm run serve」実行時のエラー

【1】「vue add vuetify」実行時の警告

https://dk521123.hatenablog.com/entry/2020/12/26/000242

で「vue add vuetify」実行時に、
以下の「警告メッセージ」が表示された。

警告メッセージ

$ vue add vuetify
 WARN  There are uncommitted changes in the current repository, it's recommended to commit or stash them first.
? Still proceed?

原因

上記のメッセージを訳せばわかる
WARN
警告
There are uncommitted changes in the current repository,
現在のリポジトリ内にコミット済みでない変更がございます。
it's recommended to commit or stash them first.
まず初めに、それらをコミットするか退避(stash)することをお勧めします

stashについては、以下。

https://backlog.com/ja/git-tutorial/reference/stash/
解決案

* 仕事で使う場合、メッセージ通り、コミットしておいた方がいいと思う
 => 理由は、コマンド実行後、App.vueなどが勝手に上書きされるので。
 => 逆に、実験用だったら、無視してもいい

【2】「npm run serve」実行時のエラー

「npm run serve」を実行した際に以下のエラーが発生。

エラー内容

npm run serve

・・・略・・・
 DONE  Compiled successfully in 13674ms                                                                                          22:47:24
ERROR in C:/xxxx/my-app/src/plugins/vuetify.ts(2,21):
2:21 Could not find a declaration file for module 'vuetify/lib/framework'. 'C:/xxxx/my-app/node_modules/vuetify/lib/framework.js' implicitly has an 'any' type.
  Try `npm install @types/vuetify` if it exists or add a new declaration (.d.ts) file containing `declare module 'vuetify/lib/framework';`
    1 | import Vue from 'vue';
  > 2 | import Vuetify from 'vuetify/lib/framework';
      |                     ^
    3 | 
    4 | Vue.use(Vuetify);
    5 | 

解決案

* 以下「修正例:src/plugins/vuetify.ts」を参考に修正

修正例:src/plugins/vuetify.ts

// import Vuetify from 'vuetify/lib/framework';
import Vuetify from 'vuetify/lib';

参考文献
https://stackoverflow.com/questions/65172139/could-not-find-a-declaration-file-for-module-vuetify-lib-framework/65172140