You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 15, 2019. It is now read-only.
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 with firebase-tools on a system using nvm which also has multiple version of node, so far as I can tell, you should use npm and not yarn to both install @google-cloud/functions-emulator globally as well as install firebase-tools globally.
I think this is because nvm segregates npm global installs by node version, while yarn 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 using nvm use and attempt to then install @google-cloud/functions-emulator globally, yarn will throw an error because angular/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 and firebase 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. both firebase-tools and @google-cloud/functions-emulator seem to need to be installed globally using the same package manager, either both npm or both yarn).
For example: if you do
yarn global add firebase-tools
nvm use v6.16.0
npm install -g @google-cloud/functions-emulator
firebase functions:shell
an error will be thrown. But everything works fine if both firebase-tools and @google-cloud/functions-emulator are installed using npm.
So, in conclusion, to use @google-cloud/functions-emulator with nvm, users should first run yarn global remove @google-cloud/functions-emulator firebase-tools and instead use nvm use to switch to the desired version of node and then run npm install -g @google-cloud/functions-emulator firebase-tools (if using node v6.x) or just npm install -g firebase-tools if using another version of node. As a reminder, users will need to reinstall firebase-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.
The text was updated successfully, but these errors were encountered:
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
).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.
The text was updated successfully, but these errors were encountered: