Skip to content

Commit cfd717f

Browse files
committed
Fetch Native Apple Silicon binaries on Node >= 16.x
1 parent a01e602 commit cfd717f

File tree

1 file changed

+17
-0
lines changed
  • crates/volta-core/src/tool/node

1 file changed

+17
-0
lines changed

crates/volta-core/src/tool/node/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,27 @@ impl Node {
129129
Node { version }
130130
}
131131

132+
#[cfg(not(all(target_os = "macos", target_arch = "aarch64")))]
132133
pub fn archive_basename(version: &Version) -> String {
133134
format!("node-v{}-{}-{}", version, NODE_DISTRO_OS, NODE_DISTRO_ARCH)
134135
}
135136

137+
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
138+
pub fn archive_basename(version: &Version) -> String {
139+
// Note: Node began shipping pre-built binaries for Apple Silicon with Major version 16
140+
// Prior to that, we need to fall back on the x64 binaries
141+
format!(
142+
"node-v{}-{}-{}",
143+
version,
144+
NODE_DISTRO_OS,
145+
if version.major >= 16 {
146+
NODE_DISTRO_ARCH
147+
} else {
148+
NODE_DISTRO_ARCH_FALLBACK
149+
}
150+
)
151+
}
152+
136153
pub fn archive_filename(version: &Version) -> String {
137154
format!(
138155
"{}.{}",

0 commit comments

Comments
 (0)