nvm-sh / nvm

Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions
MIT License
77.94k stars 7.81k forks source link

Failed to install node 14 darwin-arm64 version #3148

Open senkorl opened 1 year ago

senkorl commented 1 year ago

Operating system and version:

macos 13.4.1 (arm64)

nvm debug output:

```sh nvm --version: v0.39.3 $TERM_PROGRAM: iTerm.app $SHELL: /bin/zsh $SHLVL: 1 whoami: 'ato' ${HOME}: /Users/ato ${NVM_DIR}: '${HOME}/.nvm' ${PATH}: ${HOME}/.composer/vendor/bin:/opt/homebrew/opt/go@1.16/bin:${HOME}/gopath16/bin:${HOME}/istio-1.15.0/bin:/opt/homebrew/opt/mysql-client/bin:${NVM_DIR}/versions/node/v18.16.1/bin:${HOME}/.composer/vendor/bin:/opt/homebrew/opt/go@1.16/bin:${HOME}/gopath16/bin:${HOME}/istio-1.15.0/bin:/opt/homebrew/opt/mysql-client/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin $PREFIX: '' ${NPM_CONFIG_PREFIX}: '' $NVM_NODEJS_ORG_MIRROR: '' $NVM_IOJS_ORG_MIRROR: '' shell version: 'zsh 5.9 (x86_64-apple-darwin22.0)' uname -a: 'Darwin 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000 arm64' checksum binary: 'shasum' OS version: macOS 13.4.1 (c) 22F770820d awk: /usr/bin/awk, awk version 20200816 curl: /usr/bin/curl, curl 7.88.1 (x86_64-apple-darwin22.0) libcurl/7.88.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.51.0 wget: /opt/homebrew/bin/wget, GNU Wget 1.21.4 在 darwin22.4.0 上编译。 sed: /usr/bin/sed cut: /usr/bin/cut basename: /usr/bin/basename rm: /bin/rm mkdir: /bin/mkdir xargs: /usr/bin/xargs git: /opt/homebrew/bin/git, git version 2.41.0 ls: grep:: No such file or directory grep: grep: aliased to grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox} (grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}), grep (BSD grep, GNU compatible) 2.6.0-FreeBSD nvm current: v18.16.1 which node: ${NVM_DIR}/versions/node/v18.16.1/bin/node which iojs: iojs not found which npm: ${NVM_DIR}/versions/node/v18.16.1/bin/npm npm config get prefix: ${NVM_DIR}/versions/node/v18.16.1 npm root -g: ${NVM_DIR}/versions/node/v18.16.1/lib/node_modules ```

nvm ls output:

```sh v10.24.1 v12.22.12 v16.20.1 -> v18.16.1 default -> lts/* (-> v18.16.1) iojs -> N/A (default) unstable -> N/A (default) node -> stable (-> v18.16.1) (default) stable -> 18.16 (-> v18.16.1) (default) lts/* -> lts/hydrogen (-> v18.16.1) lts/argon -> v4.9.1 (-> N/A) lts/boron -> v6.17.1 (-> N/A) lts/carbon -> v8.17.0 (-> N/A) lts/dubnium -> v10.24.1 lts/erbium -> v12.22.12 lts/fermium -> v14.21.3 (-> N/A) lts/gallium -> v16.20.1 lts/hydrogen -> v18.16.1 ```

How did you install nvm?

brew install nvm, homebrew

What steps did you perform?

nvm install 14

What happened?

Downloading and installing node v14.21.3... Downloading https://nodejs.org/dist/v14.21.3/node-v14.21.3-darwin-arm64.tar.xz... curl: (22) The requested URL returned error: 404

Binary download from https://nodejs.org/dist/v14.21.3/node-v14.21.3-darwin-arm64.tar.xz failed, trying source. grep: /Users/ato/.nvm/.cache/bin/node-v14.21.3-darwin-arm64/node-v14.21.3-darwin-arm64.tar.xz: No such file or directory Provided file to checksum does not exist. Binary download failed, trying source.

What did you expect to happen?

download success

Is there anything in any of your profile files that modifies the PATH?

no

If you are having installation issues, or getting "N/A", what does curl -I --compressed -v https://nodejs.org/dist/ print out?

```sh * Trying 104.20.23.46:443... * Connected to nodejs.org (104.20.23.46) port 443 (#0) * ALPN: offers h2,http/1.1 * (304) (OUT), TLS handshake, Client hello (1): * CAfile: /etc/ssl/cert.pem * CApath: none * (304) (IN), TLS handshake, Server hello (2): * (304) (IN), TLS handshake, Unknown (8): * (304) (IN), TLS handshake, Certificate (11): * (304) (IN), TLS handshake, CERT verify (15): * (304) (IN), TLS handshake, Finished (20): * (304) (OUT), TLS handshake, Finished (20): * SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256 * ALPN: server accepted h2 * Server certificate: * subject: CN=*.nodejs.org * start date: Feb 3 00:00:00 2023 GMT * expire date: Mar 5 23:59:59 2024 GMT * subjectAltName: host "nodejs.org" matched cert's "nodejs.org" * issuer: C=GB; ST=Greater Manchester; L=Salford; O=Sectigo Limited; CN=Sectigo RSA Domain Validation Secure Server CA * SSL certificate verify ok. * using HTTP/2 * h2h3 [:method: HEAD] * h2h3 [:path: /dist/] * h2h3 [:scheme: https] * h2h3 [:authority: nodejs.org] * h2h3 [user-agent: curl/7.88.1] * h2h3 [accept: */*] * h2h3 [accept-encoding: deflate, gzip] * Using Stream ID: 1 (easy handle 0x11f80c600) > HEAD /dist/ HTTP/2 > Host: nodejs.org > user-agent: curl/7.88.1 > accept: */* > accept-encoding: deflate, gzip > < HTTP/2 200 HTTP/2 200 < date: Sun, 16 Jul 2023 17:20:26 GMT date: Sun, 16 Jul 2023 17:20:26 GMT < content-type: text/html content-type: text/html < cache-control: public, max-age=14400, s-maxage=14400 cache-control: public, max-age=14400, s-maxage=14400 < last-modified: Sun, 16 Jul 2023 16:05:20 GMT last-modified: Sun, 16 Jul 2023 16:05:20 GMT < cf-cache-status: HIT cf-cache-status: HIT < age: 4506 age: 4506 < vary: Accept-Encoding vary: Accept-Encoding < strict-transport-security: max-age=31536000; includeSubDomains; preload strict-transport-security: max-age=31536000; includeSubDomains; preload < x-content-type-options: nosniff x-content-type-options: nosniff < server: cloudflare server: cloudflare < cf-ray: 7e7bea75e8de3505-NRT cf-ray: 7e7bea75e8de3505-NRT < content-encoding: gzip content-encoding: gzip < * Connection #0 to host nodejs.org left intact ```
ljharb commented 1 year ago

nvm is not supported when installed from homebrew (as the brew formula should have told you). Please remove it and install it properly with the install script in the readme.

The issue tho is that node 14 doesn’t have any arm64 builds, so you’ll have to use Rosetta.

senkorl commented 1 year ago

nvm is not supported when installed from homebrew (as the brew formula should have told you). Please remove it and install it properly with the install script in the readme.

The issue tho is that node 14 doesn’t have any arm64 builds, so you’ll have to use Rosetta.

thank you for its work. emmm, I have a small doubt, Why is the link for downloading version 14 not x86 but arm64? and I tried to install version 10 and its link was x86.

ljharb commented 1 year ago

Hmm, node 14 does seem to have a darwin-x64 version https://nodejs.org/dist/latest-v14.x/

What's the full output from nvm install 14 on a non-rosetta terminal?

senkorl commented 1 year ago

Hmm, node 14 does seem to have a darwin-x64 version https://nodejs.org/dist/latest-v14.x/

What's the full output from nvm install 14 on a non-rosetta terminal?

only version 14 is happend. other older versions are download version x86.

Downloading and installing node v14.21.3...
Downloading https://nodejs.org/dist/v14.21.3/node-v14.21.3-darwin-arm64.tar.xz...
curl: (22) The requested URL returned error: 404

Binary download from https://nodejs.org/dist/v14.21.3/node-v14.21.3-darwin-arm64.tar.xz failed, trying source.
grep: /Users/ato/.nvm/.cache/bin/node-v14.21.3-darwin-arm64/node-v14.21.3-darwin-arm64.tar.xz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
ljharb commented 1 year ago

odd - that URL shouldn't 404 - you can see it right here: https://nodejs.org/dist/v14.21.3/

You're not using a mirror, so it should really be working.

senkorl commented 1 year ago

odd - that URL shouldn't 404 - you can see it right here: https://nodejs.org/dist/v14.21.3/

You're not using a mirror, so it should really be working.

this site (https://nodejs.org/dist/v14.21.3/) not found node-v14.21.3-darwin-arm64.tar.xz. but it appeared when i input nvm install 14

ljharb commented 1 year ago

ah, that's true, that means there isn't a darwin arm64 build.

Turns out you can compile node 14 on darwin arm64, but there's no binary build until node 16. Which means that nvm install 14 should fail to find the binary, and then attempt to compile the source. Does it not?

senkorl commented 1 year ago

ah, that's true, that means there isn't a darwin arm64 build.

Turns out you can compile node 14 on darwin arm64, but there's no binary build until node 16. Which means that nvm install 14 should fail to find the binary, and then attempt to compile the source. Does it not?

Yes, its. since this binary package does not actually exist, this is obviously an error. Who caused this error? node or nvm?

senkorl commented 1 year ago

It may be that the official list of API data exposed by node has arm64, but it is not

ljharb commented 1 year ago

It's not actually a problem - it's just that nvm doesn't have a hardcoded special case for node 14 + darwin + arm64, so it tries to find the binary, fails correctly, and then falls back to the source.

senkorl commented 1 year ago

It's not actually a problem - it's just that nvm doesn't have a hardcoded special case for node 14 + darwin + arm64, so it tries to find the binary, fails correctly, and then falls back to the source.

i know. this is not smooth in the process, and at least there will be no more issues to solve this problem

ljharb commented 1 year ago

I’m not sure what’s not smooth about it - the output is usually ignored unless the command fails.

LeonardoRick commented 6 months ago

I'm facing the same problem and not being able to download node 14 using nvm. Does anyone knows a palliative solution while this bug is not fixed?

ljharb commented 6 months ago

@LeonardoRick run a terminal in rosetta mode and it should work. also make sure youre on latest nvm.

LeonardoRick commented 6 months ago

@ljharb Thanks! I'll try that. I managed to install the 14 versions checking out to nvm version 0.39.1

danny-faith commented 5 months ago

@ljharb Thanks! I'll try that. I managed to install the 14 versions checking out to nvm version 0.39.1

I'm on nvm version 0.39.7. Did you also go back in nvm versions to get this to work?

john1625b commented 3 months ago

installing 0.39.1 worked for me. you can install it like so:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

michaelryancaputo commented 2 months ago

@ljharb Thanks! I'll try that. I managed to install the 14 versions checking out to nvm version 0.39.1

This seems to have worked for me as well.

A colleague mentioned that 0.39.7 worked for them as well.

xunWuKong commented 2 months ago

Can be executed at the terminal: arch -x86_64 zsh

Then execute it again:nvm install v14.21.3

Now, you can see the prompt for successful installation

image
xunWuKong commented 1 month ago

可以在终端执行:arch -x86_64 zsh 然后再次执行:nvm install v14.21.3 现在,你就可以看到安装成功的提示 了!图像

是因为node14没有ARM架构的安装包,同时使用nvm安装node会根据系统架构自动拼接下载链接,所以会安装不上。 这是强制将终端暂时调整为 64位的,然后再安装就可以了

dvag-lukas-rybacki commented 1 month ago

Is there any solution for this? I'm using the setup-node action and it still fails with message: Unable to find Node version '14.x' for platform darwin and architecture arm64. Even with a fix version of 14.21.3

ljharb commented 1 month ago

@dvag-lukas-rybacki setup-node doesn’t use nvm, afaik. I use ljharb/actions/node/install personally, which uses nvm.

dvag-lukas-rybacki commented 1 month ago

@ljharb looks like the job is using nvm or did i missunderstand something? https://github.com/actions/setup-node/blob/main/.github/workflows/versions.yml#L48

ljharb commented 1 month ago

@dvag-lukas-rybacki oh cool, i didn't realize. it'd be important that it uses the latest version of nvm tho; older ones definitely will have trouble in this scenario.

usama831 commented 2 weeks ago

I encountered the same issue. I resolved it by downloading binaries from https://nodejs.raccoon-tw.dev/ and then using the following commands:

mkdir -p ~/.nvm/versions/node/v14.17.1 tar -xJf node-v14.17.1-darwin-x64.tar.xz -C ~/.nvm/versions/node/v14.17.1 --strip-components=1 nvm use 14.17.1