FIrebase deploy error: Cannot find module 'firebase-admin'

Related searches

I recently started getting the error below when trying to deploy to Firebase (after having done so successfully in the past). I'm not sure what might have changed for this to start occurring. If I run firebase serve to serve on the localhost, everything works fine. My package.json and requires from index.js are also below.

i  deploying functions, hosting
i  functions: ensuring necessary APIs are enabled...
i  runtimeconfig: ensuring necessary APIs are enabled...
+  runtimeconfig: all necessary APIs are enabled
+  functions: all necessary APIs are enabled
i  functions: preparing functions directory for uploading...
i  functions: packaged functions (46.02 KB) for uploading
+  functions: functions folder uploaded successfully
i  hosting: preparing public directory for upload...
!  Warning: Public directory does not contain index.html
+  hosting: 9 files uploaded successfully
i  starting release process (may take several minutes)...
i  functions: updating function app...
!  functions[app]: Deploy Error: Function load error: Code in file index.js can't be loaded.
Did you list all required modules in the package.json dependencies?
Detailed stack trace: Error: Cannot find module 'firebase-admin'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/user_code/node_modules/firebase-functions/lib/apps.j
s:25:16)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)


Functions deploy had errors. To continue deploying other features (such as datab
ase), run:
firebase deploy --except functions

Error: Functions did not deploy properly.

package.json:

{
"name": "functions",
"description": "Cloud Functions for Firebase",
"dependencies": {
"@google-cloud/vision": "^0.12.0",
"async": "^2.5.0",
"consolidate": "^0.14.5",
"express": "^4.15.4",
"firebase-admin": "^5.4.0",
"firebase-functions": "^0.5.7",
"handlebars": "^4.0.10",
"jquery": "^3.2.1",
"js-levenshtein": "^1.1.3",
"json-query": "^2.2.2"
},
"private": true
}

From index.js:

const functions = require('firebase-functions');
const firebase = require('firebase-admin');
const express = require('express');
const engines = require('consolidate');
const Vision = require('@google-cloud/vision');
const levenshtein = require('js-levenshtein');
const restName = require('./restName');
const parser = require('./parser');
const jsonQuery = require('json-query')

const firebaseApp = firebase.initializeApp(
functions.config().firebase
);

They have an active service disruption. Follow this for a workaround: https://status.firebase.google.com/incident/Functions/17024

Run the following commands inside the functions repository:

npm install --save-exact firebase-functions@0.7.0 npm install --save-exact firebase-admin@5.4.0

Then try deploying functions again:

firebase deploy --only functions

If npm doesn't work, you can try yarn which worked for us:

yarn add firebase-functions@0.7.0 --exact yarn add firebase-admin@5.4.0 --exact

Deployment unsuccessful. Cannot find module � Issue #131 , Version info firebase-functions: 0.7.2 firebase-tools: firebase-admin: 5.4.3 Detailed stack trace: Error: Cannot find module 'fluentReports' at� FIrebase deploy error: Cannot find module 'firebase-admin' Ask Question Asked 2 years, 9 months ago. Active 1 year, 2 months ago. Viewed 18k times 17. 3. I recently

Update file package.json in folder functions and look at dependencies remove sign ~ from firebase-admin and ^ from firebase-functions it should be like:

"dependencies": {
  "firebase-admin": "5.4.0",
  "firebase-functions": "0.7.0"
}

in command line type

npm install

and then try to deploy again.

Function load error; Cannot find module . � Issue #784 � firebase , I ran $ firebase deploy --only functions,hosting . I get errors after/at the end of the deploy seemingly during function start where there are� Dismiss Join GitHub today. GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.

So the issue is that package.json inside Functions folder is different from package.json in your project directory. yes, you have 2 of this file!

So if you want to deploy, (deploy Functions), run npm install express or install other dependencies inside Function folder and you will be able to deploy with no error.

Firebase deploy error, Get code examples like "Firebase deploy error - Cannot find module. I hadn't installed the firebase module in the functions folder but had� Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question.Provide details and share your research! But avoid …. Asking for help, clarification, or responding to other answers.

I went to the functions directory and ran yarn (or npm install if you are old-school). Then went back to my project directory and ran firebase deploy again.

After Firebase deploy - Error: cannot find module - firebase - html, Running a Node.js function in the local Firebase server does not result in the error below, but when I do firebase deploy and try to run the same function on the � For TypeScript users, if you are importing a built-in Node module (such as http, path or url) and you are getting an error such as "Cannot find module "x" then the error can be fixed by running npm install @types/node --save-dev

I also got same error. i fix that error from installing different version in nodejs. I uninstall my new version and i install Node v7.8.0. then it works fine :)

Version info firebase-tools 3.18.5 node 8.11.2 Platform Information OS X / macOS Steps to reproduce I have one function called server modeled after the sample code here. It&#39;s an https function

firebase serve --host 0.0.0.0 // accepts requests to any host Deploy to your site. To deploy to your site, run the following command from the root of your local project directory: firebase deploy. This command deploys a release to the following sites: Your Firebase project's default Hosting sites, PROJECT_ID.web.app and PROJECT_ID.firebaseapp.com

Version info firebase-functions: 0.7.2 firebase-tools: firebase-admin: 5.4.3 My env is node 8.9.0 npm 5.5.1 firebase 3.14.0 Test case package.json { &quot;name&quot

Well, I've found that I was using Node.JS Latest version (11.1.0). I just changed the environment to Node LTS version and it works like charm.

Comments
  • Just started getting the same error
  • It works! Thanks! And double thanks for the yarn hint! npm wouldn't install it due to "Unsupported engine for bun@0.0.11: wanted: {"node":"~0.10.12"} (current: {"node":"6.11.1","npm":"5.5.1"})"
  • seems to be fixed on my side (Norway)... neither the npm nor the yarn workaround worked for me.
  • I'm now getting: Deploy Error: Failed to configure trigger providers/cloud.firestore/eventTypes/document.write@firestore.googleapis.com
  • Upgrading from beta to v1 fixed this for me: firebase.google.com/docs/functions/beta-v1-diff