2019/05/09現在の最新バージョンであるv6.9.1で実行するとエラーが出て進めなかったのでメモ。
この事象は既にIssuesの中で議論されているので近い内にfixされると思われる。
Issues
https://github.com/firebase/firebase-tools/issues/1262
一時的な解決策として、firebase-toolsのバージョンを6.8.0に戻すとエラーは解消される。6.8.0より後のバージョンについて。6.9.0が2019/05/07, 6.9.1が2019/05/09にリリースされているのでこの日以降にダウンロードした人は要注意。
エラーの内容
動作環境
MaxOS Mojave
node v8.16.0
firebase v6.9.1
$ firebase serve --only functions
✔ functions: Using node@8 from host.
✔ functions: Emulator started at http://localhost:5001
i functions: Watching "/Users/xxx" for Cloud Functions...
⚠ The Cloud Functions emulator requires the module "firebase-admin" to be installed. This package is in your package.json, but it's not available. You probably need to run "npm install" in your functions directory.
i functions: Your functions could not be parsed due to an issue with your node_modules (see above)
npm install
を実行してもエラーは解消されない(node_modules
を削除して実行しても同じ)
解決策
npm uninstall -g firebase-tools
npm install -g firebase-tools@6.8.0
$ firebase -V
6.8.0