asdf-vm / asdf-vm/asdf-nodejs

Differing commands when installing 14.19.3 on MacOS/ZSH have weird results

Open
#363 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Shell
Stars
989
Forks
162
PR merge metrics
No merged PRs in 30d

Description

I know that using "weird results" in a title is a sign you're about to get the worst issue report ever, but let me output what I run into and we can judge from there.

When running `asdf install nodejs` it would fail to download:

```sh
> asdf install nodejs
Trying to update node-build... ok
Downloading node-v14.19.3.tar.gz...
-> https://nodejs.org/dist/v14.19.3/node-v14.19.3.tar.gz
error: failed to download node-v14.19.3.tar.gz
-> https://nodejs.org/dist/v14.19.3/node-v14.19.3.tar.gz
error: failed to download node-v14.19.3.tar.gz

BUILD FAILED (OS X 13.4.1 using node-build 4.9.119)
```

I was able to download the file with `wget`. I thought it might be related to https://github.com/asdf-vm/asdf-nodejs/issues/344, but I do not have `aria2c` in my path.

To try and diagnose the problem, I tried to use `ASDF_NODEJS_VERBOSE_INSTALL`. I ran the command like:
```sh
ASDF_NODEJS_VERBOSE_INSTALL=true asdf install nodejs
```
However, this started to build nodejs from source, as if I had set `ASDF_NODEJS_FORCE_COMPILE`. I can't paste the results because it was thousands of lines of linking. Here's a snippet:
```sh
c++ -o /private/var/folders/fy/z9d_zt5d6lvdrr00m6lghsnw0000gp/T/node-build.20230731144435.64499.uYwkeU/node-v14.19.3/out/Release/obj.target/node/gen/node_code_cache.o /private/var/folders/fy/z9d_zt5d6lvdrr00m6lghsnw0000gp/T/node-build.20230731144435.64499.uYwkeU/node-v14.19.3/out/Release/obj/gen/node_code_cache.cc '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_DARWIN_USE_64_BIT_INODE=1' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNODE_ARCH="arm64"' '-DNODE_WANT_INTERNALS=1' '-D__POSIX__' '-DNODE_USE_V8_PLATFORM=1' '-DNODE_HAVE_I18N_SUPPORT=1' '-DNODE_PLATFORM="darwin"' '-DHAVE_OPENSSL=1' '-DUCONFIG_NO_SERVICE=1' '-DU_ENABLE_DYLOAD=0' '-DU_STATIC_IMPLEMENTATION=1' '-DU_HAVE_STD_STRING=1' '-DUCONFIG_NO_BREAK_ITERATION=0' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DNGHTTP2_STATICLIB' -I../src -I../deps/v8/include -I../deps/histogram/src -I../deps/uvwasi/include -I../deps/icu-small/source/i18n -I../deps/icu-small/source/common -I../deps/zlib -I../deps/llhttp/include -I../deps/cares/include -I../deps/uv/include -I../deps/nghttp2/lib/includes -I../deps/brotli/c/include -I../deps/openssl/openssl/include -O3 -gdwarf-2 -mmacosx-version-min=10.13 -arch arm64 -Wall -Wendif-labels -W -Wno-unused-parameter -Werror=undefined-inline -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++1y -stdlib=libc++ -fno-rtti -fno-exceptions -fno-strict-aliasing -MMD -MF /private/var/folders/fy/z9d_zt5d6lvdrr00m6lghsnw0000gp/T/node-build.20230731144435.64499.uYwkeU/node-v14.19.3/out/Release/.deps//private/var/folders/fy/z9d_zt5d6lvdrr00m6lghsnw0000gp/T/node-build.20230731144435.64499.uYwkeU/node-v14.19.3/out/Release/obj.target/node/gen/node_code_cache.o.d.raw -I/Users/andrewszczepanski/.asdf/installs/nodejs/14.19.3/include -c
c++ -o /private/var/folders/fy/z9d_zt5d6lvdrr00m6lghsnw0000gp/T/node-build.20230731144435.64499.uYwkeU/node-v14.19.3/out/Release/obj.target/node/gen/node_snapshot.o /private/var/folders/fy/z9d_zt5d6lvdrr00m6lghsnw0000gp/T/node-build.20230731144435.64499.uYwkeU/node-v14.19.3/out/Release/obj/gen/node_snapshot.cc '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_DARWIN_USE_64_BIT_INODE=1' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNODE_ARCH="arm64"' '-DNODE_WANT_INTERNALS=1' '-D__POSIX__' '-DNODE_USE_V8_PLATFORM=1' '-DNODE_HAVE_I18N_SUPPORT=1' '-DNODE_PLATFORM="darwin"' '-DHAVE_OPENSSL=1' '-DUCONFIG_NO_SERVICE=1' '-DU_ENABLE_DYLOAD=0' '-DU_STATIC_IMPLEMENTATION=1' '-DU_HAVE_STD_STRING=1' '-DUCONFIG_NO_BREAK_ITERATION=0' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DNGHTTP2_STATICLIB' -I../src -I../deps/v8/include -I../deps/histogram/src -I../deps/uvwasi/include -I../deps/icu-small/source/i18n -I../deps/icu-small/source/common -I../deps/zlib -I../deps/llhttp/include -I../deps/cares/include -I../deps/uv/include -I../deps/nghttp2/lib/includes -I../deps/brotli/c/include -I../deps/openssl/openssl/include -O3 -gdwarf-2 -mmacosx-version-min=10.13 -arch arm64 -Wall -Wendif-labels -W -Wno-unused-parameter -Werror=undefined-inline -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++1y -stdlib=libc++ -fno-rtti -fno-exceptions -fno-strict-aliasing -MMD -MF /private/var/folders/fy/z9d_zt5d6lvdrr00m6lghsnw0000gp/T/node-build.20230731144435.64499.uYwkeU/node-v14.19.3/out/Release/.deps//private/var/folders/fy/z9d_zt5d6lvdrr00m6lghsnw0000gp/T/node-build.20230731144435.64499.uYwkeU/node-v14.19.3/out/Release/obj.target/node/gen/node_snapshot.o.d.raw -I/Users/andrewszczepanski/.asdf/installs/nodejs/14.19.3/include -c
```
It took a long long long time, probably because of a mix of building and having to repeatedly flush tons of stuff to stdout.

I was going to post an issue about that. To help with the issue description, I was going to `time` both of the previous commands to show that `asdf install nodejs` was probably not building from source while the command with the env var was.

BUT when I ran install with `time` it worked:

```sh
> time asdf install nodejs
Trying to update node-build... ok
Downloading node-v14.19.3.tar.gz...
-> https://nodejs.org/dist/v14.19.3/node-v14.19.3.tar.gz

WARNING: node-v14.19.3 is in LTS Maintenance mode and nearing its end of life.
It only receives *critical* security updates, *critical* bug fixes and documentation updates.

Installing node-v14.19.3...
Installed node-v14.19.3 to /Users/andrewszczepanski/.asdf/installs/nodejs/14.19.3
```

One idea I had was maybe it has to do with arg parsing. I noticed that asdf-nodejs parse scripts using `$1` and `$2`. However, `time` doesn't clobber arguments, as shown with this simple test:
```sh
> echo "echo \$1" > test_script.sh
> chmod 755 test_script.sh
> ./test_script.sh hello
hello
> time ./test_script.sh hello
hello
./test_script.sh hello 0.00s user 0.01s system 42% cpu 0.022 total
```

It also wasn't nodejs.org being flaky -- I tried the command a few times and received `error: failed to download node-v14.19.3.tar.gz` while downloading it in between runs with `wget`.

Other than that, I'm at a loss as to what it could be. It seems like a major Heisenbug.

I don't really expect anyone to fix this with this information given, but maybe if someone else runs into it they can simply use `time` to workaround it.

Specs/maybe useful info:
Chip Apple M1 Pro
mac OS 13.4.1 (22F82)
zsh 5.9 (arm-apple-darwin21.3.0)
asdf v0.12.0
On company VPN

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.