为何Firebase Cloud Functions采用老旧的Node v6.11.5版本?
Great question—this was a super common frustration when Firebase Cloud Functions first rolled out with Node.js 6.11.5! Let’s dive into the key reasons behind that choice:
Stability via Long-Term Support (LTS)
Back when Cloud Functions launched, Node.js 6 was an active Long-Term Support (LTS) version. Cloud platforms prioritize LTS releases because they offer extended bug fixes, security patches, and predictable maintenance cycles. Picking a battle-tested LTS version ensured that the service would be reliable for production workloads right out the gate, avoiding the risks that come with newer, less stable Node.js releases.Infrastructure Compatibility
Firebase Cloud Functions runs on Google’s underlying cloud infrastructure. At the time, the runtime environment, tooling, monitoring systems, and scaling logic were all optimized and tested for Node.js 6. Upgrading to a newer Node version would have required reworking and validating all these components to ensure they played nicely together—something that takes significant time and testing to get right.Transpilation as a Practical Workaround
While Node.js 6 didn’t support all ES6+ features natively, the Firebase team pointed developers to transpilation tools like Babel or TypeScript. These tools let you write modern ES6+ code and convert it to Node 6-compatible syntax before deployment. It was seen as a viable temporary solution while the team worked on updating the runtime to support newer Node versions.
It’s worth noting that Firebase has since updated Cloud Functions to support much newer Node.js LTS versions (like 18 and 20 at the time of writing), so this limitation is a thing of the past for most users now.
内容的提问来源于stack exchange,提问作者Divyansh Goenka

