【问题标题】:Firebase not deploying from command line in macFirebase 未从 mac 中的命令行部署
【发布时间】:2018-09-17 09:16:14
【问题描述】:

一段时间以来,我一直在尝试部署我的 firebase 函数项目,但我似乎做不到。我遵循了其他一些问题建议,但没有一个有效。我尝试在预部署中添加转义冒号:

"predeploy": [
      "npm --prefix \"$RESOURCE_DIR\""
]

而且我还尝试将我的间隔文件夹重命名为一个单词文件夹,但它也没有奏效。这是错误:

Error: functions predeploy error: Command terminated with non-zero exit code1

这是我的 package.json:

{
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "lint": "eslint .",
    "serve": "firebase serve --only functions",
    "shell": "firebase experimental:functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "dependencies": {
    "firebase-admin": "^5.8.2",
    "firebase-functions": "^1.0.1"
  },
  "private": true
}

这是我的 firebase.json:

{
  "database": {
    "rules": "database.rules.json"
  },
  "functions": {
    "predeploy": [
      "npm --prefix \"$RESOURCE_DIR\""
    ]
  },
  "storage": {
    "rules": "storage.rules"
  }
}

注意:我自己从预部署中删除了运行 lint。

我什至无法部署helloWorld 示例函数。尝试为该项目提供服务时,我收到此警告:

Warning: You're using Node.js v9.4.0 but Google Cloud Functions only supports v6.11.5

但是,该项目实际上是正确服务的。我也试过全局卸载google-cloud并重新安装,警告没有消失。

请帮帮我,我的想法已经用完了。提前谢谢你。

【问题讨论】:

    标签: node.js firebase google-cloud-functions firebase-cli


    【解决方案1】:

    你要么删除 npm --prefix 要么添加至少一个

    {
      "functions": {
        "predeploy": [],
        "source": "functions"
      }
    }
    

    或者你试试这个:

    {
      "functions": {
        "predeploy": [
          "npm --prefix \"$RESOURCE_DIR\" run lint"
        ],
        "source": "functions"
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2018-08-06
      • 2012-09-28
      • 2015-05-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多