Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 16 additions & 0 deletions .changeset/tired-jobs-find.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'@offckb/cli': patch
---

fix(install): force x86_64 architecture on Windows

CKB only provides x86_64 binaries for Windows, not aarch64.
When Windows ARM devices reported 'arm64' via os.arch(), the code
tried to download a non-existent 'aarch64-pc-windows-msvc' binary,
resulting in a 404 error.

This fix forces all Windows systems to use x86_64, which:

- Works correctly on Windows x64
- Works via emulation on Windows ARM devices
- Matches the only Windows binary CKB provides
6 changes: 6 additions & 0 deletions src/node/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@
}

function getArch(): string {
// CKB only provides x86_64 binaries for Windows
// Return x86_64 for all Windows systems (works on ARM via emulation)
if (os.platform() === 'win32') {
return 'x86_64';
}

const arch = os.arch();
if (arch === 'x64') {
return 'x86_64';
Expand Down Expand Up @@ -172,7 +178,7 @@
const CPUFeatures = require('cpu-features');
const features = CPUFeatures();
if (features.arch === 'x86') {
const flags = features.flags as any; // CPUFeatures.X86CpuFlags

Check warning on line 181 in src/node/install.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type

Check warning on line 181 in src/node/install.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
// if lacks any of the following instruction, use portable binary
cachedIsPortable = !(flags.avx2 && flags.sse4_2 && flags.bmi2 && flags.pclmulqdq);
} else {
Expand Down
Loading