【问题标题】:Firebase Deploy Error while deploying functions部署函数时出现 Firebase 部署错误
【发布时间】:2022-01-09 02:33:58
【问题描述】:

我已经安装了:

npm 8.1.4

节点 16.13.0

我正在尝试将一些功能部署到 Unity 项目的 Firebase 数据库,但执行 firebase deploy 命令时返回错误:

C:\Users\xxx\OneDrive\CloudFunction\FirebaseFunctions\functions>firebase deploy

=== Deploying to 'xxx'...

i  deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint

> lint
> eslint .

C:\Users\xxx\OneDrive\CloudFunction\FirebaseFunctions\functions\index.js
  47:95  error  Parsing error: Unexpected token =>

✖ 1 problem (1 error, 0 warnings)

node:events:368
      throw er; // Unhandled 'error' event
      ^

Error: spawn npm --prefix "%RESOURCE_DIR%" run lint ENOENT
    at notFoundError (C:\Users\xxx\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:6:26)
    at verifyENOENT (C:\Users\xxx\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:40:16)
    at ChildProcess.cp.emit (C:\Users\xxx\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:27:25)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess.cp.emit (C:\Users\xxx\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:30:37)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) {
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn npm --prefix "%RESOURCE_DIR%" run lint',
  path: 'npm --prefix "%RESOURCE_DIR%" run lint',
  spawnargs: []
}

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

由于 lint 对我来说是新的,以下错误是什么意思以及如何解决:

Error: spawn npm --prefix "%RESOURCE_DIR%" run lint ENOENT

错误也指向index.js中的这个UploadAndCompressVideo函数:

exports.UploadAndCompressVideo = functions.runWith(vdeioUploadOpts).https.onCall(async (data) => {
    ...
});

【问题讨论】:

    标签: node.js npm firebase-realtime-database lint


    【解决方案1】:

    我会参考:

    ESLint Parsing error: Unexpected token:

    以及为我做的其中一个答案中的评论:

    我没有将 ecmaVersion: 2017 更改为 ecmaVersion: 2020,而是更改了 "scripts": { "lint": "eslint 。" } to "scripts": { "lint": "eslint" } 在 package.json 文件中。 – 艾丽顿奥利维拉 4 月 29 日 1:03

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-04-10
      • 2017-12-12
      • 2018-09-13
      • 2020-03-26
      • 2021-06-04
      • 2023-02-07
      • 2021-05-14
      相关资源
      最近更新 更多