Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

fix Compatible with M1 mac below Node.js 16.0.0 #30

Merged
merged 2 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions nodejs/nodejs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ function PLUGIN:PreInstall(ctx)
ext = ".zip"
osType = "win"
end

-- add logic for macOS M1~
if OS_TYPE == "darwin" then
local major, _ = extract_semver(version)
if major and tonumber(major) <= 16 then
arch_type = "x86"
end
end

local filename = FileName:format(version, osType, arch_type, ext)
local baseUrl = NodeBaseUrl:format(version)

Expand Down
9 changes: 9 additions & 0 deletions nodejs/npmmirror.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ function PLUGIN:PreInstall(ctx)
ext = ".zip"
osType = "win"
end

-- add logic for macOS M1~
if OS_TYPE == "darwin" then
local major, _ = extract_semver(version)
if major and tonumber(major) <= 16 then
arch_type = "x86"
end
end

local filename = FileName:format(version, osType, arch_type, ext)
local baseUrl = NodeBaseUrl:format(version)

Expand Down