无法在“ / Library / Java / JavaVirtualMachines /…”中找到可执行文件

我想安装一个NPM Express生成器:

sudo apt npm install -g express-generator

它引发以下错误:

Unable to locate an executable at "/Library/Java/JavaVirtualMachines/openjdk-14.0.1.jdk/Contents/Home/bin/apt" (-1)

我在此路径中安装了Java(它不在System / Library /中-也许就是这个问题?):

'MacintoshSSD /库/Java/JavaVirtualMachines/openjdk-14.0.1.jdk/Contents/Home'

我的.bash_profile看起来像这样:

export JAVA_HOME=$(/usr/libexec/java_home)

如果我检查JAVA_HOME看起来很好:

echo $JAVA_HOME /Library/Java/JavaVirtualMachines/openjdk-14.0.1.jdk/Contents/Home

..和Java版本:

java --version openjdk 14.0.1 2020-04-14 OpenJDK Runtime Environment (build 14.0.1+7) OpenJDK 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)

知道为什么它仍然可以找到可执行文件吗?

I an other thread I read about a possible conflict between the pre-installed macOS Java-Version and the Orcalce Java-Version enter link description here but I couldn`t work it out..

并且您可以向我解释java_home和JAVA_HOME之间的区别吗?

评论
魂淡
魂淡

The apt-tool was removed in JDK 8. So the solution is to use an upgraded npm package that does not require an outdated java version.

更新:

  • conflict between the pre-installed macOS Java-Version and the Orcalce Java-Version: Apple stopped pre-installing Java in macOS 10.7 so this should not be an issue.

  • difference between java_home and JAVA_HOME: JAVA_HOME is an environment variable that points to your Java installation. java_home is a utility program in macOS that makes it easier to correctly set up your JAVA_HOME by listing installed Java versions and the values to use for JAVA_HOME.

点赞
评论