【发布时间】:2021-10-14 18:54:39
【问题描述】:
我正在尝试在 index.ts 中使用 firebase 函数:
import * as functions from "firebase-functions";
export const helloWorld = functions.https.onRequest((request, response) => {
functions.logger.info("Hello logs!", { structuredData: true });
response.send("Hello from Firebase!");
});
在尝试firebase deploy 命令时,我不断收到此问题:
events.js:377
throw er; // Unhandled 'error' event
^
可能是什么问题? PS我成功部署一次(第一次),此后没有运气。
编辑
完整输出:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ lint: `eslint --ext .js,.ts .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the functions@ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\USERNAME\AppData\Roaming\npm-cache\_logs\2021-08-13T19_50_21_744Z-debug.log
events.js:377
throw er; // Unhandled 'error' event
^
Error: spawn npm --prefix "%RESOURCE_DIR%" run lint ENOENT
at notFoundError (C:\Users\USERNAME\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:6:26)
at verifyENOENT (C:\Users\USERNAME\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\USERNAME\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 (internal/child_process.js:277:12)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess.cp.emit (C:\Users\USERNAME\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 (internal/child_process.js:277: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
【问题讨论】:
-
您好,这似乎与 Flutter 无关,所以请移除 [Flutter] 标签。
-
您好,能否请您提供完整的错误信息,这可能有助于我们理解完整的问题。在我看来,这似乎是处理您的承诺的问题。
-
您可以尝试运行
firebase deploy --only functions --debug并分享完整的输出吗? -
@ZeenathSN 请查看编辑
-
@Dharmaraj 请查看编辑
标签: typescript firebase google-cloud-functions