Open jorroll opened 5 years ago
Actually, the emulator should support Node 8 by now, but this package hasn't got a release for a while now.
Check the package.json engines property: https://github.com/GoogleCloudPlatform/cloud-functions-emulator/blob/master/package.json#L8 That was done on #287
But this is the latest version released: https://github.com/GoogleCloudPlatform/cloud-functions-emulator/blob/1.0.0-beta.5/package.json#L8
All we need is a new version released and that issue should be solved.
This is a proposed documentation improvement
I would submit this as a PR to the wiki "detailed installation instructions" docs, but I can't see a way of editing a wiki page.
When attempting to use the
@google-cloud/functions-emulator
withfirebase-tools
on a system usingnvm
which also has multiple version of node, so far as I can tell, you should usenpm
and notyarn
to both install@google-cloud/functions-emulator
globally as well as installfirebase-tools
globally.I think this is because
nvm
segregates npm global installs by node version, whileyarn
global installs are shared between all node versions. Thus, if you install multiple packages globally via yarn which require different, incompatible versions of node, you're going to run into an error.As an example, when using nvm in an Angular v7 monorepo which contains a project representing firebase cloud functions, the firebase functions package.json will require node v6.x while the rest of the repo will require node v8.x. If you install v7 of
@angular/cli
globally via yarn, it will require you to be using node >8.x. If you switch to node v6.x usingnvm use
and attempt to then install@google-cloud/functions-emulator
globally, yarn will throw an error becauseangular/cli
does not work with node v6 (and yarn shares global packages between node versions--or, probably more accurately, nvm doesn't seem to segregate yarn global packages like it does npm ones.).Additionally, when emulating firebase cloud functions using
@google-cloud/functions-emulator
andfirebase functions:shell
, the firebase-tools global install expects the@google-cloud/functions-emulator
global install to be installed using the same package manager (i.e. bothfirebase-tools
and@google-cloud/functions-emulator
seem to need to be installed globally using the same package manager, either bothnpm
or bothyarn
).an error will be thrown. But everything works fine if both
firebase-tools
and@google-cloud/functions-emulator
are installed usingnpm
.So, in conclusion, to use
@google-cloud/functions-emulator
withnvm
, users should first runyarn global remove @google-cloud/functions-emulator firebase-tools
and instead usenvm use
to switch to the desired version of node and then runnpm install -g @google-cloud/functions-emulator firebase-tools
(if using node v6.x) or justnpm install -g firebase-tools
if using another version of node. As a reminder, users will need to reinstallfirebase-tools
globally for each version of node they have on their system.I'm guessing angular + yarn + firebase is a common enough combo that it would be worthwhile to add a comment linking to more information in the readme.