Firebase Deploy error – There was an unknown problem while trying to parse function triggers. Please ensure you are using Node.js v6 or greater

huangapple go评论68阅读模式
英文:

Firebase Deploy error - There was an unknown problem while trying to parse function triggers. Please ensure you are using Node.js v6 or greater

问题

当尝试执行 firebase deploy --only functions 时,出现了以下错误信息:

"在尝试解析函数触发器时发生未知问题。请确保您正在使用 Node.js 版本 6 或更高版本。"

我尝试使用了以下 Node.js 版本:node -v v10.10.0node -v v8.11.1node -v v10.15.3,但仍然遇到了这个问题。

背景信息:这是我6个月前开发的项目,之前没有问题。但今天我尝试重新部署(没有更改代码),却遇到了这个错误。

我不知道该如何继续工作,非常感谢任何想法。

以下是完整的日志:

firebase deploy --only functions

=== 正在部署到 'invoice-manager-251609'...
i  正在部署函数
运行命令npm --prefix "$RESOURCE_DIR" run lint

> functions@ lint D:\work\ocr\receiptWeb\functions
> eslint .

D:\work\ocr\receiptWeb\functions\index.js
  127:25  警告  避免嵌套的 promises              promise/no-nesting
  127:25  警告  避免嵌套的 promises              promise/no-nesting
  128:35  警告  不要在循环内创建函数  no-loop-func
  132:40  警告  避免嵌套的 promises              promise/no-nesting
  132:40  警告  避免嵌套的 promises              promise/no-nesting
  134:44  警告  避免嵌套的 promises              promise/no-nesting
  146:38  警告  不要在循环内创建函数  no-loop-func
  424:28  警告  避免嵌套的 promises              promise/no-nesting
  424:28  警告  避免嵌套的 promises              promise/no-nesting
  465:28  警告  避免嵌套的 promises              promise/no-nesting
  465:28  警告  避免嵌套的 promises              promise/no-nesting

D:\work\ocr\receiptWeb\functions\ReceiptGv.js
  368:43  警告  不要在循环内创建函数  no-loop-func

 12 个问题0 个错误12 个警告

+  functions: 已完成运行预部署脚本
i  functions: 确保启用了必要的 API...
+  functions: 所有必要的 API 都已启用
i  functions: 准备上传的函数目录...

错误在尝试解析函数触发器时发生未知问题请确保您正在使用 Node.js 版本 6 或更高版本

请注意,这些警告并不是新的,我之前可以部署项目时也存在这些警告。

有时会出现以下附加信息:"遇到问题?请重试或联系支持,提供 firebase-debug.log 的内容",但我在谷歌上找不到关于 "firebase-debug.log" 的任何信息。

英文:

I'm getting There was an unknown problem while trying to parse function triggers. Please ensure you are using Node.js v6 or greater

when trying to do firebase deploy --only functions

I tried with node -v v10.10.0 node -v v8.11.1 node -v v10.15.3

Background: this is a project that I develop 6 month ago, it worked with no issue, but today I tried to re-deploy (no changes in the code) and I get this error.

I have no idea how to work from here, would appreciate any idea.

here is the full log:

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

firebase deploy --only functions
=== Deploying to &#39;invoice-manager-251609&#39;...
i  deploying functions
Running command: npm --prefix &quot;$RESOURCE_DIR&quot; run lint
&gt; functions@ lint D:\work\ocr\receiptWeb\functions
&gt; eslint .
D:\work\ocr\receiptWeb\functions\index.js
127:25  warning  Avoid nesting promises              promise/no-nesting
127:25  warning  Avoid nesting promises              promise/no-nesting
128:35  warning  Don&#39;t make functions within a loop  no-loop-func
132:40  warning  Avoid nesting promises              promise/no-nesting
132:40  warning  Avoid nesting promises              promise/no-nesting
134:44  warning  Avoid nesting promises              promise/no-nesting
146:38  warning  Don&#39;t make functions within a loop  no-loop-func
424:28  warning  Avoid nesting promises              promise/no-nesting
424:28  warning  Avoid nesting promises              promise/no-nesting
465:28  warning  Avoid nesting promises              promise/no-nesting
465:28  warning  Avoid nesting promises              promise/no-nesting
D:\work\ocr\receiptWeb\functions\ReceiptGv.js
368:43  warning  Don&#39;t make functions within a loop  no-loop-func
✖ 12 problems (0 errors, 12 warnings)
+  functions: Finished running predeploy script.
i  functions: ensuring necessary APIs are enabled...
+  functions: all necessary APIs are enabled
i  functions: preparing functions directory for uploading...
Error: There was an unknown problem while trying to parse function triggers. Please ensure you are using Node.js v6 or greater.

<!-- end snippet -->

NOTE: the warnings are not new, and I could deploy the project with them in the past.

sometimes it gives this addiation line Having trouble? Try again or contact support with contents of firebase-debug.log

but I couldn't find any info about firebase-debug.log in google.

答案1

得分: 7

安装不同版本的 Node 对我没有起作用,但是从 functions 文件夹中删除 node-modules 文件夹,然后重新安装依赖项可以解决问题。

英文:

Installing a different node verion didn't work for me, but removing the node-modules folder from functions and then re-installing dependencies did.

答案2

得分: 3

通过安装Node v8.17.0来解决。

英文:

Solve by installing node v8.17.0

答案3

得分: 0

请通过在您的控制台或终端中键入(node -v)来检查您的Node版本,还要检查位于functions文件夹内的Package.json文件,并检查以下代码。

"engines": {
"node": "14"
},

上述代码表示我想要部署Firebase。在这种情况下,我应该已经在我的电脑上安装了Node 14或14+版本。

英文:

Please check your Node version by typing ( node -v ) in your console or Terminal and also check your Package.json which is inside functions and check the below code.

  &quot;engines&quot;: {
&quot;node&quot;: &quot;14&quot;
},

The above means I want to deploy firebase. In this case, I should already install node 14 or 14 + version on my pc.

答案4

得分: 0

有一个 bug 在 firebase-tools 中(我现在记不清楚是哪个版本了),已经修复了。只需确保你安装了最新版本:

npm install -g firebase-tools@latest
英文:

There was a bug in firebase-tools (I can't remember what version now) which was fixed. Just make sure you have the latest running:

npm install -g firebase-tools@latest

答案5

得分: 0

无需更新 Node 版本或依赖项,我们经常运行以下命令:

firebase deploy --only functions

请按照以下简单步骤操作:

1:打开 package.json 文件

在 script 对象中添加以下内容:

"deploy": "firebase deploy --only \"functions:<your function name>\"",

它会看起来像这样:

"scripts": {
  "lint": "eslint .",
  "serve": "firebase serve",
  "shell": "firebase functions:shell",
  "start": "npm run shell",
  "deploy": "firebase deploy --only \"functions:app\"",
  "logs": "firebase functions:log"
},

2:然后从 package.json 文件中运行此 deploy 脚本。

它会起作用!

英文:

There is no need to update Node versions or dependencies
we often run the command:

firebase deploy --only functions

use these simple steps:

1: Go to the package.json file

in the script object add the following:

&quot;deploy&quot;: &quot;firebase deploy --only \&quot;functions:&lt;your function name&gt;\&quot;&quot;,

it will look like this:

  &quot;scripts&quot;: {
&quot;lint&quot;: &quot;eslint .&quot;,
&quot;serve&quot;: &quot;firebase serve&quot;,
&quot;shell&quot;: &quot;firebase functions:shell&quot;,
&quot;start&quot;: &quot;npm run shell&quot;,
&quot;deploy&quot;: &quot;firebase deploy --only \&quot;functions:app\&quot;&quot;,
&quot;logs&quot;: &quot;firebase functions:log&quot;
},

2: then run this deploy script from package.json file.

it will work!.

答案6

得分: 0

检查是否在与将要部署的端口上运行该应用程序。
在我的情况下,我只需停止在本地运行脚本,就可以毫无问题地工作。

英文:

Check if you are running the app in the same port that is going to be deployed.
In my case a just had to stop running the script locally and it worked with no problem

huangapple
  • 本文由 发表于 2020年1月3日 15:25:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/59574689.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定