Skip to content

Commit

Permalink
Improve Node.js version warning for standalone. Fix #2791. (#4583)
Browse files Browse the repository at this point in the history
* Improve Node.js version warning for standalone. Fix #2791.

* Add changelog.

* Move generic message to else branch.

* Update CHANGELOG.md

Co-authored-by: Bryan Kendall <bkend@google.com>

Co-authored-by: Bryan Kendall <bkend@google.com>
  • Loading branch information
yuchenshi and bkendall committed May 24, 2022
1 parent c3ecb83 commit 5d2f23f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -0,0 +1 @@
- Improves Node.js version warning for standalone Firebase CLI build (#2791).
19 changes: 15 additions & 4 deletions src/emulator/functionsEmulator.ts
Expand Up @@ -1014,10 +1014,21 @@ export class FunctionsEmulator implements EmulatorInstance {
);
} else {
// Otherwise we'll warn and use the version that is currently running this process.
this.logger.log(
"WARN",
`Your requested "node" version "${requestedMajorVersion}" doesn't match your global version "${hostMajorVersion}". Using node@${hostMajorVersion} from host.`
);
if (process.env.FIREPIT_VERSION) {
this.logger.log(
"WARN",
`You've requested "node" version "${requestedMajorVersion}", but the standalone Firebase CLI comes with bundled Node "${hostMajorVersion}".`
);
this.logger.log(
"INFO",
`To use a different Node.js version, consider removing the standalone Firebase CLI and switching to "firebase-tools" on npm.`
);
} else {
this.logger.log(
"WARN",
`Your requested "node" version "${requestedMajorVersion}" doesn't match your global version "${hostMajorVersion}". Using node@${hostMajorVersion} from host.`
);
}
}

return process.execPath;
Expand Down

0 comments on commit 5d2f23f

Please sign in to comment.