简体   繁体   中英

Nuxt FATAL error when initializing '@nuxtjs/firebase' module - Cannot find module 'firebase/compat/app'

I have a working nuxt ssr app hosted on firebase functions. I am trying to add firebase analytics to my project. Based on the tutorials, I have added '@nuxtjs/firebase' module on package.json and installed all the dependencies. Now, I added the following code on nuxt.config.js file.

modules: [
  '@nuxtjs/firebase',
],
firebase: {
  config: {
    apiKey: '<apiKey>',
    authDomain: '<authDomain>',
    databaseURL: '<databaseURL>',
    projectId: '<projectId>',
    storageBucket: '<storageBucket>',
    messagingSenderId: '<messagingSenderId>',
    appId: '<appId>',
    measurementId: '<measurementId>'
  },
  services: {
    analytics: true
  }
}

When I run this code with npm run dev , I get the following error.

 WARN  Module @nuxtjs/firebase not found. Please ensure @nuxtjs/firebase is in dependencies and installed.

 FATAL  Cannot find module 'firebase/compat/app'                                                                        
 Require stack:

I couldn't find any answers anywhere.

You also need to install the base firebase package.

yarn add firebase

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM