'How to install Firebase/auth in Vue js

I am working on Vuetify. I wanna add firebase authentication command:

npm install --save firebase firebase/app firebase/auth firebase/database

I got this error

npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t ssh://[email protected]/firebase/database.git
npm ERR!
npm ERR! [email protected]: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128

I already added SSH into my Github. It works well until now Please help me



Solution 1:[1]

I also first tried installing firebase/auth, @firebase/auth, none of them worked. I then installed only firebase with the command, as the answer above.

npm install --save firebase

In the main.js I had to add a configuration to initialize firebase.

var firebaseConfig = {
    apiKey: "yourkey",
    // authDomain: "configure if needed",
    // projectId: "configure if needed",
    // storageBucket: "configure if needed",
    // messagingSenderId: "configure if needed",
    // appId: "configure if needed"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);

Solution 2:[2]

You just have to do npm install --save firebase.

Then in your firebaseConfig.js file, you would do:

import firebase from 'firebase/app';
import 'firebase/database';
import 'firebase/auth';
//...

More details in the doc here (Tab "Using module bundlers") and here (expand the "Available Firebase JS SDKs (using bundler with modules)" category).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shamsul Arefin Sajib
Solution 2 Renaud Tarnec