1

Nothing I do here seems to work, I can't find an example anywhere that actually seems correct

This:

import { initializeApp } from 'firebase-admin/app';

Throws:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '\path\to\my-proj\functions\node_modules\firebase-admin\app' imported from \path\to\my-proj\functions\index.js

This:

import * as admin from "firebase-admin";
admin.initializeApp();

Throws:

TypeError: admin.initializeApp is not a function

my functions' package.json looks like:

  "dependencies": {
    "firebase-admin": "^9.12.0",
    "firebase-functions": "^3.20.1"
  },

What's going on, what's the correct syntax?

1 Answer 1

2

You're using code samples meant for version 10 of firebase-admin, whereas you have version 9 installed. Read this for more information and run npm install firebase-admin@latest to get the latest version 10.1.0.

Sign up to request clarification or add additional context in comments.

1 Comment

i hate the way npm ~doesnt~ update things. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.