firebase-tools: verifyDeveloperNodeModules() fails to discover "firebase-admin"

Related issues

#1243 and #1258

[REQUIRED] Version info

node: 8.16.0

firebase-functions: 2.3.0

firebase-tools: 6.9.1 (NOTE: Works on 6.8.0)

firebase-admin: 7.3.0

I am running this on Windows 10.

[REQUIRED] Test case

A freshly generated firebase project using firebase init with functions.

[REQUIRED] Steps to reproduce

  1. Run npm run start (or firebase functions:shell)

[REQUIRED] Expected behavior

The emulator starts correctly

[REQUIRED] Actual behavior

The following logs are shown:

!  The Cloud Functions emulator requires the module "firebase-admin" to be installed. This package is in your package.json, but it's not available. You probably need to run "npm install" in your functions directory.
i  functions: Your functions could not be parsed due to an issue with your node_modules (see above)

Were you able to successfully deploy your functions?

Yes, deploying works fine. The deployed function (hello world) as well

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 23
  • Comments: 26 (7 by maintainers)

Commits related to this issue

Most upvoted comments

This is a bug in firebase-tools versions 6.9.0 and 6.9.1. The solution is to downgrade to 6.8.0 for now:

npm install -g firebase-tools@6.8.0

ref: https://stackoverflow.com/a/56065094/4319131

Experiencing the same issue:

✔  functions: Using node@8 from host.
✔  functions: Emulator started at http://localhost:5001
i  functions: Watching "/home/yerzhan/projects/askimam/functions" for Cloud Functions...
⚠  The Cloud Functions emulator requires the module "firebase-admin" to be installed. This package is in your package.json, but it's not available. You probably need to run "npm install" in your functions directory.
i  functions: Your functions could not be parsed due to an issue with your node_modules (see above)
firebase -V
6.9.1
  "dependencies": {
    "firebase-admin": "^7.3.0",
    "firebase-functions": "^2.3.0"
  },

Though the firebase-admin package does exist in node_modules.

@diogolessa Downgrading to firebase-tools 6.8.0 also fixes the problem, is that not an option for you?

Alright folks, we’ve just merged in a fix for this which will go out in 6.9.2 today. We may wait on a fix for #1265 before releasing, but if that doesn’t make it, this will go out as is. Once it’s out, I’ll close this bug, but please re-open if the issue is still happening for you.

upgraded from 6.8.0 to 6.9.2 and am now seeing:

functions: Using node@8 from host.

! The Cloud Functions emulator requires the module “firebase-functions-test” to be installed as a development dependency. To fix this, run “npm install --save-dev firebase-functions-test” in your functions directory. i functions: Your functions could not be parsed due to an issue with your node_modules (see above)

This is not currently documented in the firebase docs for running functions locally and definitely needs to be if a fix isn’t already ready.

Version 6.9.2 has been released with this fix.

The fix didn’t stick. We are seeing this error in "firebase-tools": "^6.10.0".

The Cloud Functions emulator requires the module “firebase-admin” to be version >7.0.0 so your version is too old. You can probably fix this by running “npm install firebase-admin@latest” in your functions directory.

We have removed the ^ from our package.json dependency for now to prevent the automatic upgrade on install.

"firebase-tools": "^6.8.0", // before
"firebase-tools": "6.8.0", // after

I am getting a lot of errors after upgrading to 6.9.2.

  1. https://github.com/firebase/firebase-tools/issues/1106
  2. https://github.com/firebase/firebase-tools/issues/1265 and few more bugs after trying to tackle down the existing ones. this upgrade is way more broken. had to downgrade to 6.8.0

Hey folks, sorry about the trouble this issue is causing. For now we recommend downgrading to 6.8.0 while we work on a patch.

[2019-05-09T09:19:26.091Z] ----------------------------------------------------------------------
[2019-05-09T09:19:26.093Z] Command:       /home/yerzhan/node-v8.12.0-linux-x64/bin/node /home/yerzhan/node-v8.12.0-linux-x64/bin/firebase emulators:start --debug
[2019-05-09T09:19:26.093Z] CLI Version:   6.9.1
[2019-05-09T09:19:26.093Z] Platform:      linux
[2019-05-09T09:19:26.093Z] Node Version:  v8.12.0
[2019-05-09T09:19:26.094Z] Time:          Thu May 09 2019 15:19:26 GMT+0600 (+06)
[2019-05-09T09:19:26.094Z] ----------------------------------------------------------------------

[2019-05-09T09:19:26.099Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2019-05-09T09:19:26.099Z] > authorizing via signed-in user
[2019-05-09T09:19:26.100Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[2019-05-09T09:19:26.100Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token  
 <request body omitted>
[2019-05-09T09:19:26.891Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=utf-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 09 May 2019 09:19:26 GMT, server=scaffolding on HTTPServer2, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,44,43,39", accept-ranges=none, transfer-encoding=chunked
[2019-05-09T09:19:26.901Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/azan-kz-ask-imam  
 
[2019-05-09T09:19:28.625Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 09 May 2019 09:19:28 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, server-timing=gfet4t7; dur=923, alt-svc=quic=":443"; ma=2592000; v="46,44,43,39", accept-ranges=none, transfer-encoding=chunked
i  Starting emulators: ["functions"]
✔  functions: Using node@8 from host.
[2019-05-09T09:19:28.637Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/674391970261:getServerAppConfig  
 
[2019-05-09T09:19:29.356Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 09 May 2019 09:19:29 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,44,43,39", accept-ranges=none, transfer-encoding=chunked
✔  functions: Emulator started at http://localhost:5001
i  functions: Watching "/home/yerzhan/projects/askimam/functions" for Cloud Functions...
[2019-05-09T09:19:29.813Z] Functions runtime initialized.
[2019-05-09T09:19:29.813Z] Disabled runtime features: undefined
⚠  The Cloud Functions emulator requires the module "firebase-admin" to be installed. This package is in your package.json, but it's not available. You probably need to run "npm install" in your functions directory.
i  functions: Your functions could not be parsed due to an issue with your node_modules (see above)