firebase-tools: Cannot start emulator

when i try to run firebase serve --only functions it gives following error and runs only hosting functions: Cannot start emulator. Error: Cannot find module '@google-cloud/functions-emulator/src/config'

About this issue

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

Commits related to this issue

Most upvoted comments

got the same issue when you have different node version than the node engine in package.json solution:

below is yarn, feel free to use npm

# install current working directory dependencies
yarn --ignore-engines

# install firebase-tools if u didn't
yarn global add firebase-tools

# install functions-emulator
yarn global add @google-cloud/functions-emulator --ignore-engines

npm install -g @google-cloud/functions-emulator fixed this for me.

problem resolved, I just simply stop using firebase. That’s it.

On Wed, Nov 14, 2018 at 1:03 AM rilian notifications@github.com wrote:

i also had recently upgraded to using node 8 and had issues with firebase serve --only functions and firebase-tools not willing to fully install @google-cloud/functions-emulator@1.0.0-beta.5: The engine “node” is incompatible with this module. Expected version “~6”. Got “8.1.0”, but –ignore-engines is really helpful - now it runs fine, though gives a warning

[Jest Dev server] $ firebase serve --only functions -p 5000 -o 0.0.0.0 [Jest Dev server] [Jest Dev server] === Serving from ‘/Users/xxx/project-name’… [Jest Dev server] [Jest Dev server] i functions: Preparing to emulate functions. [Jest Dev server] Warning: You’re using Node.js v8.1.0 but Google Cloud Functions only supports v6.11.5.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/firebase/firebase-tools/issues/552#issuecomment-438375329, or mute the thread https://github.com/notifications/unsubscribe-auth/Acq9nGZycDnglAuFYQiMNNVaQX9XEyTRks5uuwl-gaJpZM4Qx6cx .

The latest firebase-tools (v3.17.5) removes grpc as a dependency, which should resolve these issues. Please upgrade by running npm i -g firebase-tools

If you are primarily using yarn in your project, use npm instead of yarn when installing firebase-tools.

yarn global remove firebase-tools
npm i - g firebase-tools

using on node 8 (with yarn) this is what worked for me: yarn add @google-cloud/functions-emulator --ignore-engines

Okay so the the google cloud-functions-emulator “only supports Node v6.x.x. It does not support Node v8.x.x” https://github.com/GoogleCloudPlatform/cloud-functions-emulator#note

The firebase docs on choosing node versions says you can use node 8 "engines": {"node": "8"} but its in beta… https://firebase.google.com/docs/functions/manage-functions#set_nodejs_version

hmmm… so i can use node8, but i cannot test it locally using cloud functions shell (if i use node8 specific syntax)? Do i have this right?

Firebase Team/Google Team, it would be helpful if you would put in the docs that the cloud functions emulator will not work with node 8 for example on this page, https://firebase.google.com/docs/functions/manage-functions#set_nodejs_version have something like

"you can set your runtime to node 8, but if you test with google cloud-functions-emulator it will be using node6.x.x and any node8 specific syntax will not work "

a similar warning here would help https://firebase.google.com/docs/functions/local-emulator#install_and_configure_the_cloud_functions_shell

also in the email you sent out (25 Feb 2019) subject: [Action required] Changes to runtimes for new Cloud Functions deployments from April 1

I have the same exact issue, tried most given solutions, nothing worked. Anyone got a solution in the meantime?

⚠  functions: Cannot start emulator. Error: Cannot find module '@google-cloud/functions-emulator/src/config'
(node:15281) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'exit' of undefined
    at /usr/local/lib/node_modules/firebase-tools/lib/command.js:82:34
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:15281) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:15281) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Tried @ddo methods but didn’t work.

Worked, after I:

  1. Reinstall Node & NPM using NVM
  2. delete firebase-tools on /usr/local/lib/node_modules (Or previous global package installed from root-level node)
  3. install firebase-tools without sudo (npm i -g firebase-tools)

I’m getting the same error

Also having the above issue after migration to node 8 functions. Using, --ignore-engines as mentioned, although I still get this warning:

Warning: You’re using Node.js v8.14.0 but Google Cloud Functions only supports v6.11.5.

@danielsada and @raelmiu Can you try:

npm uninstall -g firebase-tools && npm i -g firebase-tools

I got here with the exact same question as @julianorinyol - is there a plan for getting the emulator to the point where it is compatible with Node 8 syntax?

npm install @google-cloud/functions-emulator --save-dev solved for me

This is what I get, anyone solved this issue?

functions: Cannot start emulator. Error: Cannot find module './acceleratedmobilepageurl/v1'
(node:16724) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'exit' of undefined
    at C:\....\node_modules\firebase-tools\lib\command.js:82:34
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:16724) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rej
ection id: 2)
(node:16724) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

sdfsdfadf

Sorry I can’t reproduce the issue, it sounds like it is similar to https://github.com/GoogleCloudPlatform/cloud-functions-emulator/issues/170#issue-278096938. So you may want to +1 that issue.

Other things you can try are:

  • upgrading npm, and then uninstall, reinstall
npm i -g npm
npm unintall -g firebase-tools && npm i -g firebase-tools