Skip to content
Myr

[Fix] `nvm_get_download_slug`: better architecture selection for M1 Macs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

If the node version is below 16.0.0 then nvm will select x86_64 architecture, else arm64 architecture.

authored by Ankit Kumar · committed by Jordan Harband · parent 4856407 · Browse files · 2 files+10 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+10 added−0 removed

  • other:+10 added−0 removed

2 files+10 added−0 removed

modified:nvm.sh+8 added
2091 unmodified lines
2092 NVM_ARCH="arm-pi"2093 fi2094 fi20952096 # If node version in below 16.0.0 then there is no arm64 packages available in node repositories, so we have to install "x64" arch packages2097 # If running MAC M1 :: arm64 arch and Darwin OS then use "x64" Architecture because node doesn't provide darwin_arm64 package below v16.0.02098 if nvm_version_greater '16.0.0' "${VERSION}"; then2099 if [ "_${NVM_OS}" = '_darwin' ] && [ "${NVM_ARCH}" = 'arm64' ]; then2100 NVM_ARCH=x642101 fi2102 fi21032104 if [ "${KIND}" = 'binary' ]; then2105 nvm_echo "${FLAVOR}-${VERSION}-${NVM_OS}-${NVM_ARCH}"2106 elif [ "${KIND}" = 'source' ]; then2107 nvm_echo "${FLAVOR}-${VERSION}"
2190 unmodified lines
modified:README.md+2 added
150 unmodified lines
151 - Try adding [the snippet from the install section](#profile_snippet), that finds the correct nvm directory and loads nvm, to your usual profile (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`).152153 - For more information about this issue and possible workarounds, please [refer here](https://github.com/nvm-sh/nvm/issues/576)154155**Note** For Macs with the M1 chip, node started providing **arm64** arch darwin packages since v16.0.0. For earlier versions, there were only **darwin_x64** packages available but no **darwin_arm64**. If you are facing issues installing node using `nvm`, you may want to update to v16 or later.156157#### Ansible158159You can use a task:160
810 unmodified lines