This used to work just fine in my Ubuntu machine with docker:
docker run --rm -t node:18 bash -c "npm i -g google-closure-compiler && google-closure-compiler --version"
Also tried the node:19 image. Both node:18 and node:19 give the same error:
/usr/local/lib/node_modules/google-closure-compiler/node_modules/google-closure-compiler-linux/compiler: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /usr/local/lib/node_modules/google-closure-compiler/node_modules/google-closure-compiler-linux/compiler)
/usr/local/lib/node_modules/google-closure-compiler/node_modules/google-closure-compiler-linux/compiler: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /usr/local/lib/node_modules/google-closure-compiler/node_modules/google-closure-compiler-linux/compiler)
Similar error if I install with yarn global add google-closure-compiler as per the GitHub documentation:
/usr/local/share/.config/yarn/global/node_modules/google-closure-compiler-linux/compiler: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /usr/local/share/.config/yarn/global/node_modules/google-closure-compiler-linux/compiler)
/usr/local/share/.config/yarn/global/node_modules/google-closure-compiler-linux/compiler: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /usr/local/share/.config/yarn/global/node_modules/google-closure-compiler-linux/compiler)
I'm wondering what has changed and what would be the simplest way to fix it. Although there are many questions with glibc errors, haven't found one that had a solution for this particular case.
GLIBC Info
This is what I get in the node:19 based container:
/lib/x86_64-linux-gnu/libc.so.6
GNU C Library (Debian GLIBC 2.31-13+deb11u5) stable release version 2.31.
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 10.2.1 20210110.
libc ABIs: UNIQUE IFUNC ABSOLUTE
For bug reporting instructions, please see:
<http://www.debian.org/Bugs/>.
So I understand the error, but I don't know why or when the closure compiler started requiring a higher GLIBC version, and most importantly, which docker image should I use to easily solve this.
Nothing Happens With Alpine Image
As an alternative, I tried the node image based on Alpine, which ironically has this warning:
The main caveat to note is that it does use musl libc instead of glibc and friends, so software will often run into issues depending on the depth of their libc requirements/assumptions.
Well, actually the libc error is gone now, but google-closure-compiler doesn't seem to do anything, see below:
$ docker run --rm -ti node:19-alpine sh
/ # npm i -g google-closure-compiler
added 27 packages in 30s
/ # google-closure-compiler --version
/ # google-closure-compiler
/ # google-closure-compiler --help
/ #
It literally outputs nothing. Any insights appreciated. As I said, it used to just work.
Ended up reverting to the previous version. This is what was available:
And installed and tested
20221102.0.1:Output:
Solved for now. Better solutions are still welcome.