WebStorm 11 全新安装未在 Mac OSX 中启动

WebStorm 11 fresh install not starting in Mac OSX

我在 El CapitanYosemite 的全新安装中都遇到过这种情况。 WebStorm 11.0.3.

当尝试从任何来源(Finder、Spotlight 等)启动 WebStorm 时,它似乎什么也没做。没有明显的错误,什么都没有。

所以我尝试在打开 OSX 的 Console 实用程序的情况下再次启动它,我发现了这些:

08/02/16 12:57:29,912 webstorm[99959]: Cannot load JVM bundle: Error Domain=NSCocoaErrorDomain Code=3587 "The bundle “OpenJDK 8” couldn’t be loaded because it is damaged or missing necessary resources." (dlopen_preflight(/Applications/WebStorm.app/Contents/jre/jdk/Contents/MacOS/libjli.dylib): no suitable image found.  Did find:
    /Applications/WebStorm.app/Contents/jre/jdk/Contents/MacOS/libjli.dylib: file too short) UserInfo=0x610000069a40 {NSLocalizedFailureReason=The bundle is damaged or missing necessary resources., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Applications/WebStorm.app/Contents/jre/jdk/Contents/MacOS/libjli.dylib, NSDebugDescription=dlopen_preflight(/Applications/WebStorm.app/Contents/jre/jdk/Contents/MacOS/libjli.dylib): no suitable image found.  Did find:
    /Applications/WebStorm.app/Contents/jre/jdk/Contents/MacOS/libjli.dylib: file too short, NSBundlePath=/Applications/WebStorm.app/Contents/jre/jdk, NSLocalizedDescription=The bundle “OpenJDK 8” couldn’t be loaded because it is damaged or missing necessary resources.}

在应用下面解决方案中所述的第一步时,我看到了这些:

08/02/16 13:01:01,146 webstorm[99970]: Value of WEBSTORM_JDK: (null)
08/02/16 13:01:01,149 webstorm[99970]: fullFileName is: /Applications/WebStorm.app/Contents/bin/webstorm.vmoptions
08/02/16 13:01:01,149 webstorm[99970]: fullFileName exists: /Applications/WebStorm.app/Contents/bin/webstorm.vmoptions
08/02/16 13:01:01,149 webstorm[99970]: Value of WEBSTORM_VM_OPTIONS is (null)
08/02/16 13:01:01,149 webstorm[99970]: Processing VMOptions file at /Applications/WebStorm.app/Contents/bin/webstorm.vmoptions
08/02/16 13:01:01,149 webstorm[99970]: Done
08/02/16 13:01:01,150 webstorm[99970]: JNI_CreateJavaVM (/Applications/WebStorm.app/Contents/jre/jdk) failed: 4294967295

在 GitHub、Jetbrain 的论坛等搜索后,我看到其他人有 JVM 问题,但并没有完全解决我的问题。

对于 libjli.dylib 问题,我在 Webstorm.app 的内容中搜索了那个文件,发现它存在于两个地方,但是其中一个文件(说该文件是太短)看起来它只是重定向到另一个文件。所以我只是复制了更大的 libjli.dylib 并替换了被抱怨的那个。

据我所知,现在没有重定向,并且控制台已从该错误中清除。但是 Webstorm 仍然没有启动,现在显示第二个错误,JNI_CreateJavaVM failed

Webstorm 和 Java 的新版本有些不对劲。我碰巧在使用 Java 1.8.

我看到的推荐和对我有用的方法是使用 Brew 安装 Java 1.6,并告诉 Webstorm.app 使用该版本。请记住,这样做,您的系统将继续使用更新的 Java 版本

所以首先在终端安装Java 1.6:

~ brew tap caskroom/versions
[...]
~ brew cask install java6
[...]
  java6 staged at '/opt/homebrew-cask/Caskroom/java6/1.6.0_65' (64M)

现在告诉 Webstorm 使用 1.6:

  1. 从 Webstorm.app 内容文件夹中打开 Info.plist 文件。
  2. <key>JVMVersion</key> 下面的行从 <string>1.6+,1.7+</string> 更改为 <string>1.6</string>
  3. 保存并关闭

现在可以使用了!

如果 Webstorm.app 尝试使用您没有(或无法找到)的 Java 版本,您将看到如下内容:

同样,对我来说,这是使用 Brew 解决的。