我一直在尝试使用云函数模拟器在本地测试我的云函数,但它似乎不起作用。当我运行时会发生什么:
firebase emulators:start
我得到以下信息:
i emulators: Starting emulators: functions
+ hub: emulator hub started at http://localhost:4400
i emulators: Shutting down emulators.
i hub: Stopping emulator hub
Error: An unexpected error has occurred.
Having trouble? Try again or contact support with contents of firebase-debug.log
这就是我的firebase.json的样子:
{
"functions": {
"predeploy": [
"npm --prefix "$RESOURCE_DIR" run lint"
]
},
"emulators": {}
}
我试过几次运行firebase init
,也试过firebase init emulators
,但到目前为止都没有成功。
我登录的帐户具有编辑权限。请帮帮我,我真的很需要这个。
我也看到了这一点,但创建一个构建为我解决了这个问题,例如npm run build
或yarn build
这将重新创建node_modules
,并可能更新您的锁定文件以同步依赖
我试过多次运行firebaseinit,以及firebaseinit模拟器,但到目前为止都没有成功。
请参阅https://firebase.google.com/docs/emulator-suite/install_and_configure。
You will need CLI version 7.8.0 or higher to use the Emulator Sute.
一开始,你能检查一下你的节点版本和firebase版本吗?
以下日志是本地计算机上的命令历史记录日志。
$ node -v
v10.20.1
$ firebase -V
8.2.0
$ firebase emulators:start
i emulators: Starting emulators: firestore
i firestore: downloading cloud-firestore-emulator-v1.11.3.jar...
Progress: ====================================================================================================> (100% of 64MB
i firestore: Removing outdated emulator files: cloud-firestore-emulator-v1.10.2.jar
i firestore: firestore emulator logging to firestore-debug.log
✔ firestore: firestore emulator started at http://localhost:8080
i firestore: For testing set FIRESTORE_EMULATOR_HOST=localhost:8080
✔ emulators: All emulators started, it is now safe to connect.
.防火钢筋混凝土{}
firebase.json{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"emulators": {
"firestore": {
"port": 8080
}
}
}