首页 > 解决方案 > 为 Firebase 模拟器打包 JSON 脚本

问题描述

我正在尝试添加一个脚本来使用从 Google 平台下载的密钥运行模拟器,但我在定位 json 文件时遇到了一些问题。它与 package.json 文件放在同一目录中

这是在 Windows 机器上

"scripts": {
    "lint": "eslint .",
    "serve": "firebase emulators:start --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log",
    "emulator": "set GOOGLE_APPLICATION_CREDENTIALS=key.json && firebase emulators:start"
  },

npm 运行模拟器

!  Error: Failed to read credentials from file key.json : Error: ENOENT: no such file or directory, open 'key.json '

标签: windowsfirebasegoogle-cloud-functions

解决方案


推荐阅读