asdf-nodejs: Unable to install node >= 18.12.0 versions

I’m using a MacOS M1 and trying to install the 18.12.0 version, but instead I receive an error message that suggests to use the flag --compile; I tried using the flag, but the error continues.

Trying to update node-build... ok
Downloading node-v18.12.0-darwin-x64.tar.gz...
-> https://nodejs.org/dist/v18.12.0/node-v18.12.0-darwin-x64.tar.gz
error: failed to download node-v18.12.0-darwin-x64.tar.gz
-> https://nodejs.org/dist/v18.12.0/node-v18.12.0-darwin-x64.tar.gz
error: failed to download node-v18.12.0-darwin-x64.tar.gz

BUILD FAILED (OS X 13.2 using node-build 4.9.88-78-g8ead6fb3)

Binary installation failed; try compiling from source with `--compile` flag

Also, reading some issues I tried some commands, like:

arch -x86_64 zsh

and after that ran the installation unsuccessfully.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 42 (8 by maintainers)

Most upvoted comments

Hi guys!

I’m facing the same issue here. I was getting the same output of @jtlimo, but installing the current LTS version (18.17.1)

asdf info:

Linux <my-host> 6.2.0-32-generic #32~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 18 10:40:13 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

SHELL:
zsh 5.8.1 (x86_64-ubuntu-linux-gnu)

ASDF VERSION:
v0.13.0-43ca61a

ASDF INSTALLED PLUGINS:
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git master 9275f49

FIX:

It seems the problem is related to aria2c, so I removed it from the HTTP clients list in ~/.asdf/plugins/nodejs/.node-build/bin/node-build

image

It just occurs with the LTS version.

The solution from @Matozinho worked for me, but I found that the underlying issue was that aria2c was broken, as per this issue. I fixed that by using the solution presented in the linked issue - by updating the gettext library using homebrew (brew upgrade gettext). If that works for you then you don’t need to edit the source code anymore, which is preferable.

I was having this issue - thought it might be aria2c but wasn’t able to find that installed anywhere.

If you land here it could be because of IPv6, the network I was on didn’t support it so I had to do:

 NODE_BUILD_CURL_OPTS=--ipv4 asdf install nodejs 20.5.0

I’m seeing this as well, not sure if its related exactly, but I run these commands:

> asdf latest nodejs
> 19.8.1

> asdf install nodejs 19.18.1
> Trying to update node-build... ok
> node-build: definition not found: 19.18.1

There was a problem with intermittent 404s affecting downloads from nodejs, which is hopefully largely resolved:

The solution from @Matozinho worked for me, but I found that the underlying issue was that aria2c was broken, as per this issue. I fixed that by using the solution presented in the linked issue - by updating the gettext library using homebrew (brew upgrade gettext). If that works for you then you don’t need to edit the source code anymore, which is preferable.

@Resa-Obamwonyi the above solution by @andycarlberg worked for me

Since this is still a problem in aria2 as @shane-lamb noted, I thought it might be helpful to know there’s an easier way to implement the fix from @Matozinho.

You can use a node-build setting variable to set the NODE_BUILD_HTTP_CLIENT before running your command.