【问题标题】:Firebase Function not being deployed in flutterFirebase 功能未部署在颤振中
【发布时间】:2020-10-03 15:24:54
【问题描述】:

我正在尝试为在 android studio 中创建的颤振应用程序部署 firebase 功能。部署时我收到以下错误。我该如何解决?

运行命令:npm --prefix "$RESOURCE_DIR" run lint

functions@lint /Users/johnny/Downloads/flutterApp5/functions eslint .

/Users/johnny/Downloads/flutterApp5/functions/index.js 18:5 错误预期 catch() 或返回
promise/catch-or-return 23:13 错误 每个 then() 都应该返回一个 价值或抛出承诺/总是返回 28:13 错误预期 catch() 或返回 promise/catch-or-return 28:13 警告 避免嵌套承诺
承诺/无嵌套 33:21 错误 每个 then() 都应该返回一个值 或抛出 promise/always-return 45:19 警告避免嵌套 承诺承诺/不嵌套 45:19 警告 避免嵌套承诺 promise/no-nesting 48:27 错误每个 then() 应该返回一个值或抛出 承诺/总是返回

✖ 8 个问题(5 个错误,3 个警告)

npm 错误!代码 ELIFECYCLE npm 错误! errno 1 npm 错误!函数@皮棉: eslint . npm 错误!退出状态 1 npm ERR! npm 错误!失败了 函数@ lint 脚本。 npm 错误!这可能不是问题 npm。上面可能还有额外的日志输出。

npm 错误!可以在以下位置找到此运行的完整日志:npm ERR!
/Users/johnny/.npm/_logs/2020-06-14T01_33_52_121Z-debug.log

错误:函数预部署错误:命令以非零终止 退出代码1

【问题讨论】:

    标签: javascript firebase flutter npm google-cloud-functions


    【解决方案1】:

    这是一个eslint 错误。检查以下错误消息。

    Running command: npm --prefix "$RESOURCE_DIR" run lint
    
    functions@ lint /Users/johnny/Downloads/flutterApp5/functions eslint .
    
    /Users/johnny/Downloads/flutterApp5/functions/index.js 18:5 error Expected catch() or return
    promise/catch-or-return 23:13 error Each then() should return a value or throw promise/always-return 28:13 error Expected catch() or return promise/catch-or-return 28:13 warning Avoid nesting promises
    promise/no-nesting 33:21 error Each then() should return a value or throw promise/always-return 45:19 warning Avoid nesting promises promise/no-nesting 45:19 warning Avoid nesting promises promise/no-nesting 48:27 error Each then() should return a value or throw promise/always-return
    
    ✖ 8 problems (5 errors, 3 warnings)
    

    您应该编辑您的代码以修复错误,或者在您的.eslintrc.json 配置文件中将promise/catch-or-returnpromise/always-return 规则从error 更改为warn

    https://github.com/xjamundx/eslint-plugin-promise

    另外

    npm --prefix "$RESOURCE_DIR" run lint 命令是functions.predeploy 文件中的functions.predeploy 设置。

    像这样。

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

    【讨论】:

      猜你喜欢
      • 2021-03-22
      • 1970-01-01
      • 2021-12-27
      • 2021-09-19
      • 2018-08-09
      • 2020-11-02
      • 1970-01-01
      • 2021-08-26
      • 2021-03-27
      相关资源
      最近更新 更多