首页 文章

Firebase不从mac中的命令行部署

提问于
浏览
0

我一直在尝试部署我的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"
  }
}

Note :我自己从预部署中删除了运行lint .

我甚至无法部署 helloWorld 示例函数 . 当试图为项目服务时,我收到了这个警告:

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

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

请帮助我,我的想法已经用完了 . 先感谢您 .

1 回答

  • 0

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

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

    或者你试试这个:

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

相关问题