[REQUIRED] Environment info
firebase-tools: 15.17.0
Platform: Windows
[REQUIRED] Test case
Any project using Firebase Functions. Run:
firebase deploy --only functions
[REQUIRED] Steps to reproduce
- Install
firebase-tools globally
- In any Firebase Functions project, run:
firebase deploy --only functions --debug
- The CLI crashes immediately on startup before deployment even begins
[REQUIRED] Expected behavior
firebase deploy --only functions should execute successfully without module resolution errors.
[REQUIRED] Actual behavior
The CLI crashes immediately with:
Error: Cannot find module 'yaml'
Require stack:
- ...\node_modules\@apphosting\build\dist\index.js
- ...\node_modules\firebase-tools\lib\apphosting\localbuilds.js
- ...\node_modules\firebase-tools\lib\deploy\apphosting\prepare.js
- ...\node_modules\firebase-tools\lib\deploy\apphosting\index.js
- ...\node_modules\firebase-tools\lib\deploy\index.js
- ...\node_modules\firebase-tools\lib\commands\deploy.js
- ...\node_modules\firebase-tools\lib\commands\index.js
- ...\node_modules\firebase-tools\lib\index.js
- ...\node_modules\firebase-tools\lib\bin\cli.js
- ...\node_modules\firebase-tools\lib\bin\firebase.js
Error: An unexpected error has occurred.
Root cause:
@apphosting/build@0.1.7 calls require("yaml") in dist/index.js at line 13:
const yaml_1 = require("yaml");
However, yaml is not declared as a dependency in @apphosting/build's package.json. Its declared dependencies are only:
{
"dependencies": {
"@apphosting/common": "^0.0.9",
"@npmcli/promise-spawn": "^3.0.0",
"colorette": "^2.0.20",
"commander": "^11.1.0",
"npm-pick-manifest": "^9.0.0",
"ts-node": "^10.9.1"
}
}
yaml is a dependency of firebase-tools itself, and @apphosting/build currently only resolves it by accidentally inheriting it through firebase-tools's node_modules via hoisting. This is not guaranteed behavior per the Node.js module resolution specification.
Suggested fix:
Add yaml to @apphosting/build's dependencies in its package.json:
{
"dependencies": {
"yaml": "^2.0.0"
}
}
[REQUIRED] Environment info
firebase-tools: 15.17.0
Platform: Windows
[REQUIRED] Test case
Any project using Firebase Functions. Run:
[REQUIRED] Steps to reproduce
firebase-toolsglobally[REQUIRED] Expected behavior
firebase deploy --only functionsshould execute successfully without module resolution errors.[REQUIRED] Actual behavior
The CLI crashes immediately with:
Root cause:
@apphosting/build@0.1.7callsrequire("yaml")indist/index.jsat line 13:However,
yamlis not declared as a dependency in@apphosting/build'spackage.json. Its declared dependencies are only:{ "dependencies": { "@apphosting/common": "^0.0.9", "@npmcli/promise-spawn": "^3.0.0", "colorette": "^2.0.20", "commander": "^11.1.0", "npm-pick-manifest": "^9.0.0", "ts-node": "^10.9.1" } }yamlis a dependency offirebase-toolsitself, and@apphosting/buildcurrently only resolves it by accidentally inheriting it throughfirebase-tools'snode_modulesvia hoisting. This is not guaranteed behavior per the Node.js module resolution specification.Suggested fix:
Add
yamlto@apphosting/build'sdependenciesin itspackage.json:{ "dependencies": { "yaml": "^2.0.0" } }