【发布时间】:2022-01-24 01:21:40
【问题描述】:
我有一台配备 M1 处理器的全新 Macbook Air
按照官方指南https://www.elastic.co/guide/en/elasticsearch/reference/current/brew.html 我尝试安装elasticsearch 7:
brew tap elastic/tap
brew install elastic/tap/elasticsearch-full
一旦我尝试使用 $ elasticsearch 启动它,我就会收到此错误:
/opt/homebrew/Cellar/elasticsearch-full/7.16.2/libexec/bin/elasticsearch-env: line 83: /opt/homebrew/Cellar/elasticsearch-full/7.16.2/libexec/jdk.app/Contents/Home/bin/java: Bad CPU type in executable
如果我尝试使用brew services start elastic/tap/elasticsearch-full 启动服务,它会失败,并且我会在日志文件/opt/homebrew/var/log/elasticsearch.log 中得到同样的错误
/opt/homebrew/Cellar/elasticsearch-full/7.16.2/libexec/bin/elasticsearch-env: line 83: /opt/homebrew/Cellar/elasticsearch-full/7.16.2/libexec/jdk.app/Contents/Home/bin/java: Bad CPU type in executable
一旦我打开导致问题第 83 行的文件 (elasticsearch-env):
# check the Java version
"$JAVA" "$XSHARE" -cp "$ES_CLASSPATH" org.elasticsearch.tools.java_version_checker.JavaVersionChecker
如果我尝试执行
/opt/homebrew/Cellar/elasticsearch-full/7.16.2/libexec/jdk.app/Contents/Home/bin/java
我得到了错误
Bad CPU type in executable
因此,在 elasticsearch-full brew 安装期间似乎安装了一个糟糕的 Java 架构(可能不是 M1,而是 x84 或其他什么?)。这是几个小时前购买的全新 Macbook。 Elasticsearch 是我尝试对其进行 brew install 的第一件事(因此没有安装之前的 Java 应用程序)
有人知道如何解决这个问题吗?
【问题讨论】: