webi-installers icon indicating copy to clipboard operation
webi-installers copied to clipboard

[BUG] WEBI_ARCH is not resolving correctly on Linux and macOS when running 'node _webi/test.js lsd' which results in generated install scripts failing to function correctly.

Open fargly opened this issue 6 months ago • 2 comments

What were you trying to install (or what else went wrong)?

Run _webi/test.js on lsd installer

What exactly did you do?

Running:

node _webi/test.js lsd Resulting install-lsd.sh has a non-valid WEBI_ARCH

Same result for 'bunx run ./_webi/test.js lsd'

What went wrong?

Invalid os.arch result translating into an undefined WEBI_ARCH entry in the generated installer. os.arch returning 'x64' instead of the expected 'x86_64'

Explanations

  • Possible missing external dependency not being met
  • Possible skill issues on my part
  • Possible issue with the installed 'node' binary
node: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=90b02322b15baa9ed32fdf18b92d57ad5b8f6268, for GNU/Linux 3.2.0, with debug_info, not stripped, too many notes (256)

Which OS did you try on?

  • [x] Mac : Works as expected
  • [ ] Windows
  • [x] Linux : Does not work correctly

What type of computer (i.e. laptop, desktop, Raspberry Pi)?

  • [ ] Laptop or Desktop (amd64 / x86-64)
  • [ ] Raspberry Pi (ARM-64)
  • [x] Other (please specify, if you know)
  • Linux VM / DISTRIB_DESCRIPTION="Ubuntu 24.10" / node --version v22.16.0
  • uname -a :
Linux lima-default 6.11.0-26-generic #26-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 12 11:25:41 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
  • Node is a fresh install with no past node development
  • [x] Other (please specify, if you know)
  • Mac mini M4
  • uname -a :
Darwin m4grendel.local 24.5.0 Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:43 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T8132 arm64

fargly avatar Jun 28 '25 17:06 fargly

Update: Further Validation of Issue

Validation Runs

Method

  1. Install webi
  2. webi node shfmt shellcheck
  3. Clone repo
  4. npm clean-install
  5. git submodule update --init
  6. node _webi/test.js lsd

Fresh Linux VM / Running on Mac Pro (macOS Sonoma) Linux lima-default 6.11.0-25-generic #⁠25-Ubuntu SMP PREEMPT_DYNAMIC Fri Apr 11 23:29:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Running Native on Mac Pro (macOS Sonoma) Darwin mpgrendel.local 23.6.0 Darwin Kernel Version 23.6.0: Fri Nov 15 15:13:28 PST 2024; root:xnu-10063.141.1.702.7~1/RELEASE_X86_64 x86_64

Running in Fresh Ubuntu 24.04 Container Linux 7ff3f787a9f3 6.8.0-62-generic #⁠65-Ubuntu SMP PREEMPT_DYNAMIC Mon May 19 17:15:03 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

All generated install scripts list WEBI_ARCH=''

$ node _webi/test.js lsd

Has the necessary files?
	  README.md: ✅ found
	releases.js: ✅ found
	 install.sh: ✅ found
	install.ps1: ✅ found

[INFO] getLatestBuilds: lsd
[Warn] REPO_BASE_DIR= not set, /home/fargly.linux/Projects/webi-installers/_repos
[INFO] getLatestBuilds: rg
dbg: Installer User-Agent: linux/6.11.0-25-generic x64/unknown gnu
dbg: Installer Host Target:
{ errors: [], os: 'linux', vendor: 'unknown', libc: 'gnu' }
dbg: Get Project Installer Type for 'lsd':
[INFO] getLatestBuilds: lsd
dbg: proj { type: 'valid', detail: true }
tmplParams {
  pkg: 'lsd',
  tag: '',
  os: 'linux',
  arch: undefined,
  libc: 'gnu',
  formats: [ 'exe', 'xz', 'tar', 'zip', 'git' ],
  limit: 1,
  channel: '',
  lts: false,
  version: ''
}

Found release matching current os, arch, and tag:
{
  triplets: [
    'aarch64-apple-darwin-none',
    'x86_64-apple-darwin-none',
    'armhf-unknown-linux-gnu',
    'x86_64-unknown-linux-none',
    'x86-unknown-linux-none',
    'aarch64-unknown-linux-none',
    'x86-unknown-linux-gnu',
    'x86_64-unknown-linux-gnu',
    'aarch64-unknown-linux-gnu',
    'x86-pc-windows-none',
    'x86_64-pc-windows-none'
  ],
  oses: [ 'darwin', 'linux', 'windows' ],
  arches: [ 'aarch64', 'x86_64', 'armhf', 'x86' ],
  libcs: [ 'none', 'gnu' ],
  formats: [ '.tar.gz', '', '.zip' ],
  latest: 'v1.1.5',
  stable: 'v1.1.5',
  name: 'doesntexist.ext',
  version: '0.0.0',
  lts: '-',
  channel: 'error',
  date: '1970-01-01',
  os: 'linux',
  arch: '-',
  libc: 'gnu',
  ext: 'err',
  download: 'https://example.com/doesntexist.ext',
  comment: "No matches found. Could be bad or missing version info,Check query parameters. Should be something like '/api/releases/{package}@{version}.tab?os={macos|linux|windows|-}&arch={amd64|x86|aarch64|arm64|armv7l|-}&libc={musl|gnu|msvc|libc|static}&limit=10'"
}

Do the scripts actually work?
	NEEDS MANUAL TEST: sh install-lsd.sh
	NEEDS MANUAL TEST: powershell.exe install-lsd.ps1


fargly avatar Jun 30 '25 14:06 fargly

Hi! @fargly I ran into this issue too when working with fish installer, I couldn't traceback the exact problem but returning 'amd64' explicitly everytime os.arch returns 'x64' fixed the issue.

In test.js,


if(nodeArch == 'x64'){
  nodeArch = 'amd64';
}

Output:


Has the necessary files?
	  README.md: ✅ found
	releases.js: ✅ found
	 install.sh: ✅ found
	install.ps1: ✅ found

dbg: Installer User-Agent: linux/6.8.0-62-generic amd64/unknown gnu
dbg: Installer Host Target:
{
  errors: [],
  os: 'linux',
  vendor: 'unknown',
  arch: 'x86_64',
  libc: 'gnu'
}
dbg: Get Project Installer Type for 'lsd':
dbg: proj { type: 'valid', detail: true }
tmplParams {
  pkg: 'lsd',
  tag: '',
  os: 'linux',
  arch: 'x86_64',
  libc: 'gnu',
  formats: [ 'exe', 'xz', 'tar', 'zip', 'git' ],
  limit: 1,
  channel: '',
  lts: false,
  version: ''
}

Now, changing test.js isnt the best practice, so try figuring out the actual cause maybe.

detox-24 avatar Jul 04 '25 23:07 detox-24