google / closure-compiler-npm

Package for managing and documenting closure-compiler for use via npm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Google Closure Compiler does not work on Mac with M3 chip

ssg3d opened this issue · comments

commented

I use Multipass to run an Ubuntu 22.04 VM on the Mac with an Apple M3 Pro chip. From within my Ubuntu VM, I install the Google Closure Compiler by sudo npm install -g google-closure-compiler. It gets installed, but running it does nothing. e.g., invoking google-closure-compiler without any params should make it read the stdin, but it simply exits. Any other argument like google-closure-compiler abc xyz also exits without any errors reported.

I filed this issue with Multipass also (canonical/multipass#3403) and they responded that its not a Multipass issue. I am reproducing their analysis:

The issue seems to be coming from the arm64 version of google-closure-compiler. Its calling java jar /usr/local/lib/node_modules/google-closure-compiler/node_modules/google-closure-compiler-java/compiler.jar and since the java runtime environment doesn't exist in the base image, nothing happens.

There isn't a native binary for that OS/architecture. Does your VM have Java installed?

Hi @ChadKillingsworth ,

I helped analyze the issue for Multipass and the problem stems that Java is not installed by default in the VM. There is absolutely no indication of what the problem is when java is not found- no error message, no indication that java needs to be installed, nothing accept for error code 254 if you check the error code. I ended up figuring out the problem by straceing the google-closure-compiler process.

That said, it works fine once default-jre is installed in the Linux VM.

We've found no reliable way to detect if a JRE is installed in a performant manner. It's a known issue. This causes issues like this one rarely, but right now there is no known fix.