Skip to content

Commit c6269e0

Browse files
joshkelrluvatonljharb
committed
[Fix] Don't override Mac M1 architecture for node ^14.17
Fixes #2743 Co-authored-by: Josh Kelley <[email protected]> Co-authored-by: Raz Luvaton <[email protected]> Co-authored-by: Jordan Harband <[email protected]>
1 parent 28b3b0e commit c6269e0

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ If the above doesn't fix the problem, you may try the following:
156156

157157
- For more information about this issue and possible workarounds, please [refer here](https://github.com/nvm-sh/nvm/issues/576)
158158

159-
**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.
159+
**Note** For Macs with the M1 chip, node started offering **arm64** arch darwin packages since v16.0.0 and experimental **arm64** support when compiling from source since v14.17.0. If you are facing issues installing node using `nvm`, you may want to update to one of those versions or later.
160160

161161
#### Ansible
162162

nvm.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2110,9 +2110,12 @@ nvm_get_download_slug() {
21102110
fi
21112111
fi
21122112

2113-
# 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 packages
2114-
# If running MAC M1 :: arm64 arch and Darwin OS then use "x64" Architecture because node doesn't provide darwin_arm64 package below v16.0.0
2115-
if nvm_version_greater '16.0.0' "${VERSION}"; then
2113+
# If running MAC M1 :: Node v14.17.0 was the first version to offer official experimental support:
2114+
# https://github.com/nodejs/node/issues/40126 (although binary distributions aren't available until v16)
2115+
if \
2116+
nvm_version_greater '14.17.0' "${VERSION}" \
2117+
|| (nvm_version_greater_than_or_equal_to "${VERSION}" '15.0.0' && nvm_version_greater '16.0.0' "${VERSION}") \
2118+
; then
21162119
if [ "_${NVM_OS}" = '_darwin' ] && [ "${NVM_ARCH}" = 'arm64' ]; then
21172120
NVM_ARCH=x64
21182121
fi

0 commit comments

Comments
 (0)