Package path ./standalone is not exported from package database-compat
See original GitHub issueBackground
Hello everyone, I’ve just installed the admin SDK and it’s bringing me the following error:
error - ./node_modules/firebase-admin/lib/app/firebase-namespace.js:106:0
Module not found: Package path ./standalone is not exported from package D:\NewRepos\1d3a\node_modules\@firebase\database-compat (see exports field in D:\NewRepos\1d3a\node_modules\@firebase\database-compat\package.json)
Import trace for requested module:
./node_modules/firebase-admin/lib/default-namespace.js
./node_modules/firebase-admin/lib/index.js
./lib/firebaseAdminSdk.ts
I’ve found this StackOverflow post regarding this, but he has not gotten answers. The only other information I have on this error is that this warning comes up when checking the relevant package’s package.json file:
Relevant Code:
import { initializeApp, apps, app } from 'firebase-admin';
import { credential } from "firebase-admin"
var firebaseAdminAccount = require("../serviceAccount.json");
var FbApp : app.App = null;
if(!apps.length)
{
FbApp = initializeApp({
credential: credential.cert(firebaseAdminAccount)
})
}
if(FbApp === null)
{
FbApp = apps[0];
}
export default FbApp;
This code is for getting the admin SDK in my backend, and not trying to initialize it twice. It’s important to note, this crashes at the imports, and not the code itself.
does anyone know how to fix this? I cannot run my site because of this.
Environment
OS: Windows 10 Firebase SDK Ver: ^11.0.1 Firebase Product: auth, but happens at initialization. Node.js: v18.7.0 NPM: v8.15.0
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Ask Question - Stack Overflow
Package path ./standalone is not exported from package ... not exported from package D:\NewRepos\1d3a\node_modules@firebase\database-compat ...
Read more >(React) Error [ERR_PACKAGE_PATH_NOT_EXPORTED]
package path not exported error. Open your terminal in your project's root directory (where your package.json file is) and run the following commands....
Read more >Module not found: Error: Package path . is not exported from ...
I was building a react project but when I tried to run it. It showed the following error: Module not found: Error: Package...
Read more >Export and import data | Firestore - Firebase
Export data. An export operation copies documents in your database to a set of files in a Cloud Storage bucket. Note that an...
Read more >Package exports - webpack
js files for "package" and the file system lookup for "package/sub/path" . When the exports field is specified, only these module requests are...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, I have recently realized that next.js middleware runs on V8, which firebase-admin cannot run at. I thought the middleware was node.js and therefor would run fine. Either way, now I gotta figure out how to run authorization before API call code all over again. Thanks for the comment though
JUST FYI,
this is actually an issue with Next JS’s middleware: https://www.reddit.com/r/Firebase/comments/sbhg4b/firebase_and_nextjs_middleware_for_authentication/