LoginSignup
3
0

More than 3 years have passed since last update.

Vue.js×firebaseでアプリを作ってるときにfirebaseを入れたらエラーが起きた

Last updated at Posted at 2020-07-24

こんにちは、Yuiです。

今回、Vue.js×firebaseで簡単なアプリを作ろうと思ってfirebaseとつなげた際に下記のエラーが起きたので、その解決策を書きます。

出たエラー

./node_modules/vuetify/lib/components/VCalendar/VCalendarDaily.js Module not found: Error: Can't resolve 'core-js/modules/es.array.concat' in '/Users/hoge/Desktop/Develop/dame.com/node_modules/vuetify/lib/components/VCalendar'

環境

$ node -v
v12.18.2

$ npm -v
6.14.5

$ vue -V
@vue/cli 4.4.6

エラーになるまでの手順

  • Vuetifyを入れて、ある程度のレイアウトを整えてnpm run serve→ここまでは大丈夫だった
  • その後、DBとつなげようと思い、firebaseを開く
  • npm install firebaseした後、main.jsに以下貼り付け
  // Your web app's Firebase configuration
  var firebaseConfig = {
    apiKey: "apiKey",
    authDomain: "authDomain.firebaseapp.com",
    databaseURL: "https://databaseURL.firebaseio.com",
    projectId: "projectId",
    storageBucket: "storageBucket.appspot.com",
    messagingSenderId: "messagingSenderId",
    appId: "x:xxxxxxxxx:web:xxxxxxxxxxxxxxxxxxxx",
    measurementId: "measurementId"
  };
  // Initialize Firebase
  firebase.initializeApp(firebaseConfig);
  firebase.analytics();
  • 再度npm run serve→ここでエラー

画面を見ると、

./node_modules/vuetify/lib/components/VCalendar/VCalendarDaily.js Module not found: Error: Can't resolve 'core-js/modules/es.array.concat' in '/Users/hoge/Desktop/Develop/dame.com/node_modules/vuetify/lib/components/VCalendar'

コンソールに吐き出されたエラーは下記

 ERROR  Failed to compile with 671 errors                               21:16:38

These dependencies were not found:

* core-js/modules/es.array.concat in ./node_modules/vuetify/lib/components/VCalendar/VCalendarDaily.js, ./node_modules/vuetify/lib/components/VCalendar/VCalendarWeekly.js and 44 others
* core-js/modules/es.array.every in ./node_modules/vuetify/lib/components/VColorPicker/util/index.js, ./node_modules/vuetify/lib/components/VDataIterator/VDataIterator.js and 3 others
* core-js/modules/es.array.fill in ./node_modules/vuetify/lib/components/VDatePicker/VDatePickerMonthTable.js, ./node_modules/vuetify/lib/components/VSparkline/VSparkline.js and 1 other
* core-js/modules/es.array.filter in ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js, ./node_modules/vuetify/lib/components/VAutocomplete/VAutocomplete.js and 19 others

エラー文が長すぎるので、全部は書かない。

解決法

どうやらcore-jsが原因かということで、

$ npm install --save core-js

これで無事エラー解消!

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0