I am working on a login system in vue, this is my code for now:
<template>
<div>
<input type="email" placeholder="Email" v-model="email" />
<input type="password" placeholder="Password" v-model="password" />
<button>Login</button>
<p>Need an account?<router-link to="/signup">Sign Up</router-link></p>
</div>
</template>
<script>
import firebase from 'firebase'
export default {
name: "Login",
data() {
return {
email: "",
password: "",
};
},
methods: {
Login() {
// Log the user in
firebase
.auth()
.signInWithEmailAndPassword(this.email, this.password)
.then(
(user) => {
console.log(user.data);
},
(err) => {
alert(err);
}
);
},
},
};
</script>
<style>
</style>
The problem is that I get an error when I try to run it, this is the error:
This dependency was not found:
* firebase in ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader-v16/dist??ref--1-1!./src/views/Login.vue?vue&type=script&lang=js
To install it, you can run: npm install --save firebase
I tried installing firebase a couple of times, but I keep getting the same error.
If anyone knows a solution, thank you very much!
CodePudding user response:
Welcome, what command are you running to install Firebase? The error says to use npm install --save firebase
, are you using that command? Try the commandnpm install Firebase
to try install Firebase. Are you using "Cloud Shell" to deploy your code?
I used the following documentation to learn about the basics of Firebase [1}
[1} https://firebase.google.com/docs/web/setup
and this lab is also very useful [2]