无法从源加载函数定义:FirebaseError:用户代码加载失败。无法确定后端规范

-1 python node.js firebase google-cloud-functions google-cloud-firestore

[必填] 环境信息

\n
    \n
  • firebase-工具:12.1.0
  • \n
  • “firebase-admin”:“^11.8.0”,
  • \n
  • “firebase-functions”:“^4.3.1”
  • \n
  • “firebase-functions-test”:“^3.1.0”
  • \n
\n

**平台:Windows wsl (Ubuntu)

\n
    \n
  • 节点:v18.16.0
  • \n
  • Python:v3.10.6
  • \n
  • openjdk:v“11.0.19”
  • \n
\n

我已按照以下步骤进行操作

\n

https://firebase.google.com/docs/functions/get-started?gen=2nd&hl=ko#about_this_tutorial

\n

但它发生了

\n

“无法从源加载函数定义:FirebaseError:用户代码加载失败。无法确定后端规范”

\n

当我运行“firebase emulators:start”命令时

\n

[错误报告]

\n

当我运行“firebase emulators:start”时

\n
`i emulators: Starting emulators: functions, firestore\n
Run Code Online (Sandbox Code Playgroud)\n

\xe2\x9a\xa0 函数:以下模拟器未运行,从函数模拟器调用这些服务将影响生产:auth、数据库、托管、pubsub、存储

\n

i firestore:Firestore 模拟器记录到 firestore-debug.log

\n

\xe2\x9c\x94 firestore:Firestore 模拟器 UI websocket 正在 9150 上运行。

\n

i ui:模拟器 UI 记录到 ui-debug.log

\n

i 函数:正在观看“/mnt/c/Users/sunwu/Downloads/Tryagain/pythontry/functions”以获取云函数...

\n

\xe2\x9c\x94 功能:使用主机上的node@18。

\n

\xe2\xac\xa2 函数:无法从源加载函数定义:FirebaseError:用户代码加载失败。无法确定\n后端规范

\n

\xe2\x94\x8c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2 \x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94 \x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80 \xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2 \x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94 \x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80 \xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2 \x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x90\n\xe2\x94\x82 \xe2\x9c\x94 所有模拟器准备就绪!现在可以安全连接您的应用程序了。\xe2\x94\x82\n\xe2\x94\x82 i 在http://127.0.0.1:4000/查看模拟器 UI \n\xe2\x94\x82\n\xe2\x94\x94\xe2\x94\ x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\ xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\ x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\ x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\ xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\ x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\ x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\ xe2\x94\x80\xe2\x94\x80\xe2\x94\x98

\n

\xe2\x94\x8c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2 \x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\xac\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94 \x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80 \xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\xac\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2 \x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94 \x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80 \xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2 \x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x90\n\xe2\x94\x82 模拟器 \xe2\x94\x82 主机:端口 \xe2\x94\x82 在模拟器 UI 中查看\n\xe2\x94\x82\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94 \x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\xbc \xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2 \x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94 \xbc\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80 \xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2 \x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94 \x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80 \xe2\x94\xa4\n\xe2\x94\x82 函数 \xe2\x94\x82 127.0.0.1:5001 \xe2\x94\x82 http://127.0.0.1:4000/functions \xe2\x94\x82\ n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\ xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\xbc\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\ x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\ x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\xbc\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\ xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\ x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\ x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\ xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\xa4\n\xe2\x94\x82 Firestore \xe2\x94\x82 127.0.0.1:8080\xe2\x94\x82 http://127.0.0.1:4000/firestore\xe2\x94\x82\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80 \xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\xb4\xe2\x94\x80\xe2\x94\x80\xe2 \x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94 \x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\xb4\xe2\x94\x80\xe2\x94\x80 \xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2 \x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94 \x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80 \xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x98

\n

模拟器集线器运行于 127.0.0.1:4400

\n

其他保留端口:4500、9150

\n

在--调试中

\n

[2023-05-24T00:10:58.203Z] 构建nodejs源

\n

[2023-05-24T00:10:58.204Z] 找不到模块节点的版本:到达搜索路径末尾

\n

/mnt/c/Users/sunwu/Downloads/Tryagain/pythontry/functions/node_modules

\n

\xe2\x9c\x94 功能:使用主机上的node@18。

\n

[2023-05-24T00:10:58.215Z] 找不到functions.yaml。必须使用http发现

\n

[2023-05-24T00:10:58.240Z] 在以下位置找到了 firebase-functions 二进制文件

\n

\'/mnt/c/Users/sunwu/Downloads/Tryagain/pythontry/functions/node_modules/.bin/firebase-functions\'

\n

[2023-05-24T00:11:02.712Z] 服务于端口 8528

\n

[2023-05-24T00:11:16.857Z] 通过 /__/quitquitquit 请求关闭

\n

\xe2\xac\xa2 函数:无法从源加载函数定义:FirebaseError:用户代码加载失败。无法确定后端规范{“metadata”:{“emulator”:{“name”:“functions”},“message”:“无法从源加载函数定义:FirebaseError:用户代码加载失败。无法确定后端规范” }}

\n

这只是一个简单的项目,所以我不知道为什么它不起作用。

\n

小智 6

遇到同样的错误

错误:用户代码加载失败。无法确定后端规格。

事实证明,当我使用firebase init初始化一个新项目时,它使用的默认nodejs版本是18

只需将package.json文件中的版本更改为系统上当前安装的版本即可。对我来说是16

“引擎”:{“节点”:“16”},

错误图像

错误图像

成功形象

成功形象