https://github.com/GoogleCloudPlatform/cloud-functions-emulator/issues/126
It seems firebase tools is not accurately reporting to cloud functions emulator that I am on v6.11.1, it will think I am on v6.9.1. and will throw an error.
Looks like all the action is happening between lines 67 to 82 of this module: https://github.com/firebase/firebase-tools/blob/master/lib/serve/functions.js.
Actually, it looks like the most recent change:
if (process.version !== 'v6.11.1') {
msg = 'Please use Node version v6.11.1, you have ' + process.version + '\n';
}
Should now return a more detailed error, as the exception won't be eaten by the version mismatch error message, which is currently saying to me:
âš functions: Cannot start emulator. Please use Node version v6.9.1, you have v6.11.1
Which means the firebase-tools version on npm is outdated and the current error message is leading me in circles. Even if you fix that, something in the try block between lines 68 and 75 is failing regardless of node version but the error message is misleading and unsolvable.
@jasonge511 What version of firebase-tools are you running? Can you run "firebase --version" and let me know what it prints out?
And if you did "npm install -g https://github.com/firebase/firebase-tools.git" to install the tip of master do you still get the same issue?
Hi, I am on [email protected], which is what is installed if I do "yarn add global firebase-tools@latest". That npm command you gave doesn't work for me:
npm ERR! git clone --template=/Users/jason/.npm/_git-remotes/_templates --mirror https://github.com/firebase/firebase-tools.git /Users/jason/.npm/_git-remotes/git-https-github-com-firebase-firebase-tools-git-29e6fd3f: xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
npm ERR! Darwin 17.0.0
npm ERR! argv "/Users/jason/.config/yarn/global/node_modules/node/bin/node" "/usr/local/bin/npm" "install" "-g" "https://github.com/firebase/firebase-tools.git"
npm ERR! node v6.11.1
npm ERR! npm v3.10.10
npm ERR! code 1
npm ERR! Command failed: git clone --template=/Users/jason/.npm/_git-remotes/_templates --mirror https://github.com/firebase/firebase-tools.git /Users/jason/.npm/_git-remotes/git-https-github-com-firebase-firebase-tools-git-29e6fd3f
npm ERR! xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
EDIT: sorry, I realized that the command you gave is not working because I haven't installed XCode, I will get back to you.
Ok, I installed the master (which still says its v3.9.1) and now I get the error message:
âš functions: Cannot start emulator. Error: Module version mismatch. Expected 48, got 51.
This is the same message I got before I installed master, when I dropped down to node v.6.9.1 to try to escape the Node version error.
So it looks like installing the master fixed the incorrect Node version error message which was eating up the exception, and the module version mismatch is the real underlying error.
Thanks for the info, I'll look into this.
Yarn global upgrade fixed this for me. For some reason my "google-cloud/functions-emulator" was on v1.0.0-alpha.16 instead of v1.0.0-alpha.22, which is the most recent. I think the firebase-tools pushed to NPM was just outdated and was not asking for >=alpha.22 as a dependency.
If you didn't tell me to merge master branch, I would still be stuck on "Please use Node version v6.9.1, you have v6.11.1". Thanks
Thanks for the info! I've updated the dependency requirement in the PR link above, and will do a release to NPM in the next 1-2 days.
Sorry to be adding to the comments after this was closed, but I am still getting the following error when trying to start the functions emulator in firebase-tools:
functions: Cannot start emulator. Please use Node version v6.11.1, you have v6.11.2
Here is what I'm running:
Node: v6.11.2
firebase: 3.9.2
Any suggestions on how to resolve this?
Thanks!
Please do what the error message says and use v6.11.1 instead.
Sorry to post on a closed issue, but what was the fix for the Expected 48, got 51. issue? I tried yarn global add firebase-tools, and I tried clearing node_modules in both my functions directory and my main project directory but no luck. I'm on node 6.11.1.
EDIT: I see that installing the tip of the master branch was recommended previously. Is that what I should try?
I got it sorted. For those who might have my problem, the solution is not just to upgrade firebase-tools, but to remove then re-add it. This happened to me because I originally installed it with a more recent version of node, then downgraded node to 6.11.1 as firebase functions requires. So:
yarn global remove firebase-tools
yarn global add firebase-tools
The following solved my problem (Expected 48, got 57)
If you're upgrading @google-cloud/functions-emulator, these
are the recommended upgrade steps:
Stop the currently running emulator, if any:
functions stop
Uninstall the current emulator, if any:
npm uninstall -g @google-cloud/functions-emulator
Install the new version of the emulator:
npm install -g @google-cloud/functions-emulator
If you have trouble after upgrading, try deleting the config
directory found in:
~/.config/configstore/@google-cloud/functions-emulator
Then restart the emulator. You can also check for any renegade
Node.js emulator processes that may need to be killed:
ps aux | grep node
Thanks for the instructions @YASSERRMD and @tweeres04 !
I tried all the steps but still no luck
@Shery11 Our latest 2 firebase-tools releases removes grpc as a dependency, which was causing a lot of the installation issues, so could you try one more time?
1) npm uninstall -g firebase-tools or yarn global remove firebase-tools
2) switch Node to v6.11.5 ( I use nvm to do this)
3) npm install -g firebase-tools or yarn global add firebase-tools
Most helpful comment
I got it sorted. For those who might have my problem, the solution is not just to upgrade
firebase-tools, but to remove then re-add it. This happened to me because I originally installed it with a more recent version of node, then downgraded node to 6.11.1 as firebase functions requires. So:yarn global remove firebase-toolsyarn global add firebase-tools