kandi background
kandi background
Explore Kits
kandi background
Explore Kits
Explore all Authentication open source software, libraries, packages, source code, cloud functions and APIs.

Popular New Releases in Authentication

March 2022: Launch Week Special

v3.7.0

v4.35.0

v1.11.7

1.0.2 Release

supabase

March 2022: Launch Week Special

monica

v3.7.0

authelia

v4.35.0

hydra

v1.11.7

jwt-auth

1.0.2 Release

Popular Libraries in Authentication

Trending New libraries in Authentication

Top Authors in Authentication

1

85 Libraries

26311

2

64 Libraries

3314

3

57 Libraries

1110

4

53 Libraries

9369

5

51 Libraries

2746

6

48 Libraries

5911

7

48 Libraries

1154

8

44 Libraries

47899

9

31 Libraries

3804

10

28 Libraries

4387

1

85 Libraries

26311

2

64 Libraries

3314

3

57 Libraries

1110

4

53 Libraries

9369

5

51 Libraries

2746

6

48 Libraries

5911

7

48 Libraries

1154

8

44 Libraries

47899

9

31 Libraries

3804

10

28 Libraries

4387

Trending Kits in Authentication

oauth

8 best OAuth

oAuth is a protocol that provides authorization. It allows users to securely access protected resources on a remote server. The application server is the entity that provides protected resources to users. The application server issues access tokens to clients who successfully authenticated with it. The client makes an authorization request to the authorization server and receives an access token in response. The client presents this token when making requests to protected resources on the application server. The application server validates the token, extracts information about the user who owns it and authorizes or denies access for that user. Spring-security-oauth is a Spring Security OAuth module that provides support for OAuth 1.0 and OAuth 2.0 in a single, easy to use module. It's an alternative to other OAuth modules for Spring Security like spring-social, spring4d and others. Passport is a library for handling authentication in Express apps built on top of the Passport Strategy Pattern. It acts as an authentication middleware between your frontend app and the server. The main problem with it is that it's very opinionated, so if you want to change something related to user authentication, you need to dive into the source code or fork it and make the changes yourself. Popular open source oAuth libraries include

Trending Discussions on Authentication

    `Firebase` package was successfully found. However, this package itself specifies a `main` module field that could not be resolved
    How to solve Invalid credentials problem in bitbucket?
    Unauthorized (Invalid Token) when authenticating with JWT Bearer Token after update to .NET 6
    Bitbucket Cloud recently stopped supporting account passwords for Git authentication
    "fatal: Authentication failed for" when pushing to GitHub from Visual Studio Code (1.62.2)
    Which Android device has BIOMETRIC_STRONG (Class 3) face authentication?
    Use token to push some code to GitHub - "Support for password authentication was removed"
    Paramiko authentication fails with "Agreed upon 'rsa-sha2-512' pubkey algorithm" (and "unsupported public key algorithm: rsa-sha2-512" in sshd log)
    refusing to allow a Personal Access Token to create or update workflow
    'AmplifySignOut' is not exported from '@aws-amplify/ui-react'

QUESTION

`Firebase` package was successfully found. However, this package itself specifies a `main` module field that could not be resolved

Asked 2022-Apr-02 at 17:19

I'm trying to read and write to firestore, use firebase's authentication, and firebase's storage within a expo managed react-native application.

Full Error:

1While trying to resolve module `firebase` from file `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\firebase.js`, the package `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index`. Indeed, none of these files exist:
2
3  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
4  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
5

My firebase config file:

1While trying to resolve module `firebase` from file `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\firebase.js`, the package `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index`. Indeed, none of these files exist:
2
3  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
4  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
5import firebase from "firebase";
6import { initializeApp } from "firebase/app";
7import "firebase/firestore";
8import "firebase/auth";
9import "firebase/storage";
10
11// I'm using the example key here, I have the correct config
12const firebaseConfig = {
13  apiKey: "api-key",
14  authDomain: "project-id.firebaseapp.com",
15  databaseURL: "https://project-id.firebaseio.com",
16  projectId: "project-id",
17  storageBucket: "project-id.appspot.com",
18  messagingSenderId: "sender-id",
19  appId: "app-id",
20  measurementId: "G-measurement-id",
21};
22
23if (firebase.apps.length === 0) {
24  initializeApp(firebaseConfig);
25}
26
27const db = firebase.firestore();
28const auth = firebase.auth();
29const storage = firebase.storage();
30
31export { db, auth, storage };
32

I installed the firebase package with:

1While trying to resolve module `firebase` from file `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\firebase.js`, the package `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index`. Indeed, none of these files exist:
2
3  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
4  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
5import firebase from "firebase";
6import { initializeApp } from "firebase/app";
7import "firebase/firestore";
8import "firebase/auth";
9import "firebase/storage";
10
11// I'm using the example key here, I have the correct config
12const firebaseConfig = {
13  apiKey: "api-key",
14  authDomain: "project-id.firebaseapp.com",
15  databaseURL: "https://project-id.firebaseio.com",
16  projectId: "project-id",
17  storageBucket: "project-id.appspot.com",
18  messagingSenderId: "sender-id",
19  appId: "app-id",
20  measurementId: "G-measurement-id",
21};
22
23if (firebase.apps.length === 0) {
24  initializeApp(firebaseConfig);
25}
26
27const db = firebase.firestore();
28const auth = firebase.auth();
29const storage = firebase.storage();
30
31export { db, auth, storage };
32expo install firebase
33

Any help would be greatly appreciated. Thank you!

ANSWER

Answered 2021-Nov-03 at 05:52

To reduce the size of the app, firebase SDK (v9.0.0) became modular. You can no longer do the import statement like before on v8.

You have two options.

  1. Use the backwards compatible way. (it will be later removed):

This:

copy icondownload icon

1While trying to resolve module `firebase` from file `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\firebase.js`, the package `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index`. Indeed, none of these files exist:
2
3  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
4  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
5import firebase from "firebase";
6import { initializeApp } from "firebase/app";
7import "firebase/firestore";
8import "firebase/auth";
9import "firebase/storage";
10
11// I'm using the example key here, I have the correct config
12const firebaseConfig = {
13  apiKey: "api-key",
14  authDomain: "project-id.firebaseapp.com",
15  databaseURL: "https://project-id.firebaseio.com",
16  projectId: "project-id",
17  storageBucket: "project-id.appspot.com",
18  messagingSenderId: "sender-id",
19  appId: "app-id",
20  measurementId: "G-measurement-id",
21};
22
23if (firebase.apps.length === 0) {
24  initializeApp(firebaseConfig);
25}
26
27const db = firebase.firestore();
28const auth = firebase.auth();
29const storage = firebase.storage();
30
31export { db, auth, storage };
32expo install firebase
33import firebase from 'firebase/app';
34import 'firebase/auth';
35import 'firebase/firestore';
36

Should be changed to:

copy icondownload icon

1While trying to resolve module `firebase` from file `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\firebase.js`, the package `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index`. Indeed, none of these files exist:
2
3  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
4  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
5import firebase from "firebase";
6import { initializeApp } from "firebase/app";
7import "firebase/firestore";
8import "firebase/auth";
9import "firebase/storage";
10
11// I'm using the example key here, I have the correct config
12const firebaseConfig = {
13  apiKey: "api-key",
14  authDomain: "project-id.firebaseapp.com",
15  databaseURL: "https://project-id.firebaseio.com",
16  projectId: "project-id",
17  storageBucket: "project-id.appspot.com",
18  messagingSenderId: "sender-id",
19  appId: "app-id",
20  measurementId: "G-measurement-id",
21};
22
23if (firebase.apps.length === 0) {
24  initializeApp(firebaseConfig);
25}
26
27const db = firebase.firestore();
28const auth = firebase.auth();
29const storage = firebase.storage();
30
31export { db, auth, storage };
32expo install firebase
33import firebase from 'firebase/app';
34import 'firebase/auth';
35import 'firebase/firestore';
36// v9 compat packages are API compatible with v8 code
37import firebase from 'firebase/compat/app';
38import 'firebase/compat/auth';
39import 'firebase/compat/firestore';
40
  1. Refactor your code now.

From this:

copy icondownload icon

1While trying to resolve module `firebase` from file `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\firebase.js`, the package `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index`. Indeed, none of these files exist:
2
3  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
4  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
5import firebase from "firebase";
6import { initializeApp } from "firebase/app";
7import "firebase/firestore";
8import "firebase/auth";
9import "firebase/storage";
10
11// I'm using the example key here, I have the correct config
12const firebaseConfig = {
13  apiKey: "api-key",
14  authDomain: "project-id.firebaseapp.com",
15  databaseURL: "https://project-id.firebaseio.com",
16  projectId: "project-id",
17  storageBucket: "project-id.appspot.com",
18  messagingSenderId: "sender-id",
19  appId: "app-id",
20  measurementId: "G-measurement-id",
21};
22
23if (firebase.apps.length === 0) {
24  initializeApp(firebaseConfig);
25}
26
27const db = firebase.firestore();
28const auth = firebase.auth();
29const storage = firebase.storage();
30
31export { db, auth, storage };
32expo install firebase
33import firebase from 'firebase/app';
34import 'firebase/auth';
35import 'firebase/firestore';
36// v9 compat packages are API compatible with v8 code
37import firebase from 'firebase/compat/app';
38import 'firebase/compat/auth';
39import 'firebase/compat/firestore';
40import firebase from "firebase/compat/app";
41import "firebase/compat/auth";
42
43const auth = firebase.auth();
44auth.onAuthStateChanged(user => { 
45  // Check for user status
46});
47

To this:

copy icondownload icon

1While trying to resolve module `firebase` from file `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\firebase.js`, the package `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index`. Indeed, none of these files exist:
2
3  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
4  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
5import firebase from "firebase";
6import { initializeApp } from "firebase/app";
7import "firebase/firestore";
8import "firebase/auth";
9import "firebase/storage";
10
11// I'm using the example key here, I have the correct config
12const firebaseConfig = {
13  apiKey: "api-key",
14  authDomain: "project-id.firebaseapp.com",
15  databaseURL: "https://project-id.firebaseio.com",
16  projectId: "project-id",
17  storageBucket: "project-id.appspot.com",
18  messagingSenderId: "sender-id",
19  appId: "app-id",
20  measurementId: "G-measurement-id",
21};
22
23if (firebase.apps.length === 0) {
24  initializeApp(firebaseConfig);
25}
26
27const db = firebase.firestore();
28const auth = firebase.auth();
29const storage = firebase.storage();
30
31export { db, auth, storage };
32expo install firebase
33import firebase from 'firebase/app';
34import 'firebase/auth';
35import 'firebase/firestore';
36// v9 compat packages are API compatible with v8 code
37import firebase from 'firebase/compat/app';
38import 'firebase/compat/auth';
39import 'firebase/compat/firestore';
40import firebase from "firebase/compat/app";
41import "firebase/compat/auth";
42
43const auth = firebase.auth();
44auth.onAuthStateChanged(user => { 
45  // Check for user status
46});
47import { getAuth, onAuthStateChanged } from "firebase/auth";
48
49const auth = getAuth(firebaseApp);
50onAuthStateChanged(auth, user => {
51  // Check for user status
52});
53

You should definitely check the documentation

Source https://stackoverflow.com/questions/69814654

Community Discussions contain sources that include Stack Exchange Network

    `Firebase` package was successfully found. However, this package itself specifies a `main` module field that could not be resolved
    How to solve Invalid credentials problem in bitbucket?
    Unauthorized (Invalid Token) when authenticating with JWT Bearer Token after update to .NET 6
    Bitbucket Cloud recently stopped supporting account passwords for Git authentication
    "fatal: Authentication failed for" when pushing to GitHub from Visual Studio Code (1.62.2)
    Which Android device has BIOMETRIC_STRONG (Class 3) face authentication?
    Use token to push some code to GitHub - "Support for password authentication was removed"
    Paramiko authentication fails with "Agreed upon 'rsa-sha2-512' pubkey algorithm" (and "unsupported public key algorithm: rsa-sha2-512" in sshd log)
    refusing to allow a Personal Access Token to create or update workflow
    'AmplifySignOut' is not exported from '@aws-amplify/ui-react'

QUESTION

`Firebase` package was successfully found. However, this package itself specifies a `main` module field that could not be resolved

Asked 2022-Apr-02 at 17:19

I'm trying to read and write to firestore, use firebase's authentication, and firebase's storage within a expo managed react-native application.

Full Error:

1While trying to resolve module `firebase` from file `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\firebase.js`, the package `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index`. Indeed, none of these files exist:
2
3  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
4  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
5

My firebase config file:

1While trying to resolve module `firebase` from file `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\firebase.js`, the package `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index`. Indeed, none of these files exist:
2
3  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
4  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
5import firebase from "firebase";
6import { initializeApp } from "firebase/app";
7import "firebase/firestore";
8import "firebase/auth";
9import "firebase/storage";
10
11// I'm using the example key here, I have the correct config
12const firebaseConfig = {
13  apiKey: "api-key",
14  authDomain: "project-id.firebaseapp.com",
15  databaseURL: "https://project-id.firebaseio.com",
16  projectId: "project-id",
17  storageBucket: "project-id.appspot.com",
18  messagingSenderId: "sender-id",
19  appId: "app-id",
20  measurementId: "G-measurement-id",
21};
22
23if (firebase.apps.length === 0) {
24  initializeApp(firebaseConfig);
25}
26
27const db = firebase.firestore();
28const auth = firebase.auth();
29const storage = firebase.storage();
30
31export { db, auth, storage };
32

I installed the firebase package with:

1While trying to resolve module `firebase` from file `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\firebase.js`, the package `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index`. Indeed, none of these files exist:
2
3  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
4  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
5import firebase from "firebase";
6import { initializeApp } from "firebase/app";
7import "firebase/firestore";
8import "firebase/auth";
9import "firebase/storage";
10
11// I'm using the example key here, I have the correct config
12const firebaseConfig = {
13  apiKey: "api-key",
14  authDomain: "project-id.firebaseapp.com",
15  databaseURL: "https://project-id.firebaseio.com",
16  projectId: "project-id",
17  storageBucket: "project-id.appspot.com",
18  messagingSenderId: "sender-id",
19  appId: "app-id",
20  measurementId: "G-measurement-id",
21};
22
23if (firebase.apps.length === 0) {
24  initializeApp(firebaseConfig);
25}
26
27const db = firebase.firestore();
28const auth = firebase.auth();
29const storage = firebase.storage();
30
31export { db, auth, storage };
32expo install firebase
33

Any help would be greatly appreciated. Thank you!

ANSWER

Answered 2021-Nov-03 at 05:52

To reduce the size of the app, firebase SDK (v9.0.0) became modular. You can no longer do the import statement like before on v8.

You have two options.

  1. Use the backwards compatible way. (it will be later removed):

This:

copy icondownload icon

1While trying to resolve module `firebase` from file `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\firebase.js`, the package `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index`. Indeed, none of these files exist:
2
3  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
4  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
5import firebase from "firebase";
6import { initializeApp } from "firebase/app";
7import "firebase/firestore";
8import "firebase/auth";
9import "firebase/storage";
10
11// I'm using the example key here, I have the correct config
12const firebaseConfig = {
13  apiKey: "api-key",
14  authDomain: "project-id.firebaseapp.com",
15  databaseURL: "https://project-id.firebaseio.com",
16  projectId: "project-id",
17  storageBucket: "project-id.appspot.com",
18  messagingSenderId: "sender-id",
19  appId: "app-id",
20  measurementId: "G-measurement-id",
21};
22
23if (firebase.apps.length === 0) {
24  initializeApp(firebaseConfig);
25}
26
27const db = firebase.firestore();
28const auth = firebase.auth();
29const storage = firebase.storage();
30
31export { db, auth, storage };
32expo install firebase
33import firebase from 'firebase/app';
34import 'firebase/auth';
35import 'firebase/firestore';
36

Should be changed to:

copy icondownload icon

1While trying to resolve module `firebase` from file `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\firebase.js`, the package `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index`. Indeed, none of these files exist:
2
3  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
4  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
5import firebase from "firebase";
6import { initializeApp } from "firebase/app";
7import "firebase/firestore";
8import "firebase/auth";
9import "firebase/storage";
10
11// I'm using the example key here, I have the correct config
12const firebaseConfig = {
13  apiKey: "api-key",
14  authDomain: "project-id.firebaseapp.com",
15  databaseURL: "https://project-id.firebaseio.com",
16  projectId: "project-id",
17  storageBucket: "project-id.appspot.com",
18  messagingSenderId: "sender-id",
19  appId: "app-id",
20  measurementId: "G-measurement-id",
21};
22
23if (firebase.apps.length === 0) {
24  initializeApp(firebaseConfig);
25}
26
27const db = firebase.firestore();
28const auth = firebase.auth();
29const storage = firebase.storage();
30
31export { db, auth, storage };
32expo install firebase
33import firebase from 'firebase/app';
34import 'firebase/auth';
35import 'firebase/firestore';
36// v9 compat packages are API compatible with v8 code
37import firebase from 'firebase/compat/app';
38import 'firebase/compat/auth';
39import 'firebase/compat/firestore';
40
  1. Refactor your code now.

From this:

copy icondownload icon

1While trying to resolve module `firebase` from file `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\firebase.js`, the package `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index`. Indeed, none of these files exist:
2
3  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
4  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
5import firebase from "firebase";
6import { initializeApp } from "firebase/app";
7import "firebase/firestore";
8import "firebase/auth";
9import "firebase/storage";
10
11// I'm using the example key here, I have the correct config
12const firebaseConfig = {
13  apiKey: "api-key",
14  authDomain: "project-id.firebaseapp.com",
15  databaseURL: "https://project-id.firebaseio.com",
16  projectId: "project-id",
17  storageBucket: "project-id.appspot.com",
18  messagingSenderId: "sender-id",
19  appId: "app-id",
20  measurementId: "G-measurement-id",
21};
22
23if (firebase.apps.length === 0) {
24  initializeApp(firebaseConfig);
25}
26
27const db = firebase.firestore();
28const auth = firebase.auth();
29const storage = firebase.storage();
30
31export { db, auth, storage };
32expo install firebase
33import firebase from 'firebase/app';
34import 'firebase/auth';
35import 'firebase/firestore';
36// v9 compat packages are API compatible with v8 code
37import firebase from 'firebase/compat/app';
38import 'firebase/compat/auth';
39import 'firebase/compat/firestore';
40import firebase from "firebase/compat/app";
41import "firebase/compat/auth";
42
43const auth = firebase.auth();
44auth.onAuthStateChanged(user => { 
45  // Check for user status
46});
47

To this:

copy icondownload icon

1While trying to resolve module `firebase` from file `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\firebase.js`, the package `C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index`. Indeed, none of these files exist:
2
3  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
4  * C:\Users\joshu\Desktop\VSProjects\VolleyballConnect\node_modules\firebase\index\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
5import firebase from "firebase";
6import { initializeApp } from "firebase/app";
7import "firebase/firestore";
8import "firebase/auth";
9import "firebase/storage";
10
11// I'm using the example key here, I have the correct config
12const firebaseConfig = {
13  apiKey: "api-key",
14  authDomain: "project-id.firebaseapp.com",
15  databaseURL: "https://project-id.firebaseio.com",
16  projectId: "project-id",
17  storageBucket: "project-id.appspot.com",
18  messagingSenderId: "sender-id",
19  appId: "app-id",
20  measurementId: "G-measurement-id",
21};
22
23if (firebase.apps.length === 0) {
24  initializeApp(firebaseConfig);
25}
26
27const db = firebase.firestore();
28const auth = firebase.auth();
29const storage = firebase.storage();
30
31export { db, auth, storage };
32expo install firebase
33import firebase from 'firebase/app';
34import 'firebase/auth';
35import 'firebase/firestore';
36// v9 compat packages are API compatible with v8 code
37import firebase from 'firebase/compat/app';
38import 'firebase/compat/auth';
39import 'firebase/compat/firestore';
40import firebase from "firebase/compat/app";
41import "firebase/compat/auth";
42
43const auth = firebase.auth();
44auth.onAuthStateChanged(user => { 
45  // Check for user status
46});
47import { getAuth, onAuthStateChanged } from "firebase/auth";
48
49const auth = getAuth(firebaseApp);
50onAuthStateChanged(auth, user => {
51  // Check for user status
52});
53

You should definitely check the documentation

Source https://stackoverflow.com/questions/69814654

Community Discussions contain sources that include Stack Exchange Network

Tutorials and Learning Resources in Authentication

Tutorials and Learning Resources are not available at this moment for Authentication

Share this Page

share link

Get latest updates on Authentication

  • © 2022 Open Weaver Inc.