Firebase Cloud Functions 模拟器抛出“exited with code: 1”错误

Sti*_*iño 8 firebase google-cloud-functions

我正在尝试设置我的本地环境以测试 Firebase 云功能。我遵循了他们的文档,但现在遇到了以下错误:

错误:firestore:模拟器已退出,代码为:1

我发现了关于这个问题的其他 SO 线程,但没有与我的特定日志:

i  Starting emulators: ["functions","firestore","hosting"]
?  Your requested "node" version "8" doesn't match your global version "12"
?  functions: Emulator started at http://localhost:5001
i  firestore: Logging to firestore-debug.log
?  firestore: Emulator started at http://localhost:8080

Error: firestore: emulator has exited with code: 1
Run Code Online (Sandbox Code Playgroud)

firestore-debug.log文件并没有真正暗示我的方向:

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/google/cloud/datastore/emulator/firestore/CloudFirestore : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Run Code Online (Sandbox Code Playgroud)

这里的任何人都知道是什么导致了这个错误?

小智 16

只需从这里下载最新的 JDK 版本


adi*_*ius 10

在 macOS 10.14 上,我需要安装最新的 openjdk 并启用它:

brew install openjdk
Run Code Online (Sandbox Code Playgroud)

在安装过程中,它将显示有关如何启用 openjdk 的说明。对我来说是:

For the system Java wrappers to find this JDK, symlink it with
  sudo ln -sfn \
    /usr/local/opt/openjdk/libexec/openjdk.jdk \
    /Library/Java/JavaVirtualMachines/openjdk.jdk
Run Code Online (Sandbox Code Playgroud)


Mar*_*hes 8

如果有人仍然为此苦苦挣扎:

emulators:start在最后再次运行您的命令--debug,以查看进程崩溃的原因,就在终端中。