Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 arm64 linux installs x64 linux binary #4717

Open
1 task done
anonrig opened this issue Dec 9, 2024 · 17 comments
Open
1 task done

🐛 arm64 linux installs x64 linux binary #4717

anonrig opened this issue Dec 9, 2024 · 17 comments
Labels
S-Needs triage Status: this issue needs to be triaged

Comments

@anonrig
Copy link
Contributor

anonrig commented Dec 9, 2024

Environment information

arm64 linux

What happened?

  1. Run pnpm i --save @biomejs/biome
  2. Fails to run biome ci etc... says x64 is not installed.

Expected result

It should properly detect arm64

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@anonrig anonrig added the S-Needs triage Status: this issue needs to be triaged label Dec 9, 2024
@dyc3
Copy link
Contributor

dyc3 commented Dec 9, 2024

I don't have a linux arm device to test this on at the moment, but do you get the same thing when you run pnpm dlx @biomejs/biome? If not, can you provide a reproduction? I have a feeling this is related to lockfiles.

@dyc3 dyc3 added the S-Needs repro Status: needs a reproduction label Dec 9, 2024

This comment was marked as resolved.

@github-actions github-actions bot removed the S-Needs triage Status: this issue needs to be triaged label Dec 9, 2024
@anonrig
Copy link
Contributor Author

anonrig commented Dec 9, 2024

I don't have a linux arm device to test this on at the moment, but do you get the same thing when you run pnpm dlx @biomejs/biome? If not, can you provide a reproduction? I have a feeling this is related to lockfiles.

cc @danlapid

@danlapid
Copy link

danlapid commented Dec 9, 2024

Any arm64 linux trying to run pnpm i --save @biomejs/biome should reproduce

@dyc3 dyc3 removed the S-Needs repro Status: needs a reproduction label Dec 9, 2024
@ematipico
Copy link
Member

ematipico commented Dec 10, 2024

Does installing https://www.npmjs.com/package/@biomejs/cli-linux-arm64 manually fix your issue?

If so, the package manager isn't installing the optional dependencies of your system.

@ematipico ematipico added the S-Needs triage Status: this issue needs to be triaged label Dec 10, 2024
@danlapid
Copy link

The standalone binary works as expected, yes
Here's the commands and the responses:

build@machine:~/directory$ npx @biomejs/biome
node:internal/modules/cjs/loader:1251
  throw err;
  ^

Error: Cannot find module '@biomejs/cli-linux-x64/biome'
Require stack:
- /home/build/directory/node_modules/.pnpm/@[email protected]/node_modules/@biomejs/biome/bin/biome
    at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
    at Function.resolve (node:internal/modules/helpers:135:19)
    at Object.<anonymous> (/home/build/directory/node_modules/.pnpm/@[email protected]/node_modules/@biomejs/biome/bin/biome:51:11)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Module._load (node:internal/modules/cjs/loader:1127:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:166:5) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/build/directory/node_modules/.pnpm/@[email protected]/node_modules/@biomejs/biome/bin/biome'
  ]
}

Node.js v22.6.0
build@machine:~/directory$ pnpm dlx @biomejs/biome
Packages: +3
+++
Progress: resolved 9, reused 3, downloaded 0, added 3, done
.cache/pnpm/dlx/obx6267tidww3arps6fgr747tq/193b579c74d-27caa/node_modules/.pnpm/@[email protected]/node_modules/@biomejs/biome: Running postinstall script, done in 326ms
node:internal/modules/cjs/loader:1251
  throw err;
  ^

Error: Cannot find module '@biomejs/cli-linux-x64/biome'
Require stack:
- /home/build/.cache/pnpm/dlx/obx6267tidww3arps6fgr747tq/193b579c74d-27caa/node_modules/.pnpm/@[email protected]/node_modules/@biomejs/biome/bin/biome
    at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
    at Function.resolve (node:internal/modules/helpers:135:19)
    at Object.<anonymous> (/home/build/.cache/pnpm/dlx/obx6267tidww3arps6fgr747tq/193b579c74d-27caa/node_modules/.pnpm/@[email protected]/node_modules/@biomejs/biome/bin/biome:51:11)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Module._load (node:internal/modules/cjs/loader:1127:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:166:5) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/build/.cache/pnpm/dlx/obx6267tidww3arps6fgr747tq/193b579c74d-27caa/node_modules/.pnpm/@[email protected]/node_modules/@biomejs/biome/bin/biome'
  ]
}

Node.js v22.6.0

@ematipico
Copy link
Member

ematipico commented Dec 11, 2024

The standalone binary works as expected, yes

That's not exactly what I was asking sorry (or maybe I misunderstood the answer). Can you install @biomejs/cli-linux-arm64 via pnpm i and then run Biome CLI e.g. pnpm exec biome format?

If this works, it means the package manager is the issue, and maybe your architecture isn't recognised by the package managers. This is the matrix of the package:

{
  "os": [

    "linux"

  ],

  "cpu": [

    "arm64"

  ],

  "libc": [

    "glibc"

  ]
}

@danlapid
Copy link

Not sure what I'm doing wrong here:

build@machine:~/directory$ pnpm i @biomejs/cli-linux-arm64
Packages: +1
+
Progress: resolved 258, reused 236, downloaded 0, added 0, done

dependencies:
+ @biomejs/cli-linux-arm64 1.9.4

 WARN  Issues with peer dependencies found
.
└─┬ eslint-plugin-import 2.30.0
  └── ✕ unmet peer eslint@"^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8": found 9.10.0

Done in 1.1s
build@machine:~/directory$ pnpm exec biome format
 ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command "biome" not found
 ```

@ematipico
Copy link
Member

You need to install @biomejs/biome AND @biomejs/cli-linux-arm64

@danlapid
Copy link

No luck:

build@machine:~/directory$ pnpm i  @biomejs/biome
Already up to date
Progress: resolved 266, reused 238, downloaded 0, added 0, done
 WARN  Issues with peer dependencies found
.
└─┬ eslint-plugin-import 2.30.0
  └── ✕ unmet peer eslint@"^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8": found 9.10.0

Done in 432ms
build@machine:~/directory$ pnpm exec biome format
node:internal/modules/cjs/loader:1251
  throw err;
  ^

Error: Cannot find module '@biomejs/cli-linux-x64/biome'
Require stack:
- /home/build/directory/node_modules/.pnpm/@[email protected]/node_modules/@biomejs/biome/bin/biome
    at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
    at Function.resolve (node:internal/modules/helpers:135:19)
    at Object.<anonymous> (/home/build/directory/node_modules/.pnpm/@[email protected]/node_modules/@biomejs/biome/bin/biome:51:11)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Module._load (node:internal/modules/cjs/loader:1127:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:166:5) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/build/directory/node_modules/.pnpm/@[email protected]/node_modules/@biomejs/biome/bin/biome'
  ]
}

Node.js v22.6.0

@ematipico
Copy link
Member

It seems like we aren't aligned. I need you to run this:

pnpm i @biomejs/biome
pnpm i @biomejs/cli-linux-arm64
pnpm exec biome --version

@danlapid
Copy link

danlapid commented Dec 11, 2024

Ok, here's the log:

build@machine:~/directory$ pnpm i @biomejs/biome
Packages: +3
+++
Progress: resolved 266, reused 238, downloaded 0, added 0, done
The following dependencies have build scripts that were ignored: @biomejs/biome

dependencies:
+ @biomejs/biome 1.9.4

 WARN  Issues with peer dependencies found
.
└─┬ eslint-plugin-import 2.30.0
  └── ✕ unmet peer eslint@"^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8": found 9.10.0

Done in 939ms
build@machine:~/directory$ pnpm i @biomejs/cli-linux-arm64
Already up to date
Progress: resolved 266, reused 238, downloaded 0, added 0, done

dependencies:
+ @biomejs/cli-linux-arm64 1.9.4

 WARN  Issues with peer dependencies found
.
└─┬ eslint-plugin-import 2.30.0
  └── ✕ unmet peer eslint@"^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8": found 9.10.0

Done in 830ms
build@machine:~/directory$ pnpm exec biome --version
node:internal/modules/cjs/loader:1251
  throw err;
  ^

Error: Cannot find module '@biomejs/cli-linux-x64/biome'
Require stack:
- /home/build/directory/node_modules/.pnpm/@[email protected]/node_modules/@biomejs/biome/bin/biome
    at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
    at Function.resolve (node:internal/modules/helpers:135:19)
    at Object.<anonymous> (/home/build/directory/node_modules/.pnpm/@[email protected]/node_modules/@biomejs/biome/bin/biome:51:11)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Module._load (node:internal/modules/cjs/loader:1127:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:166:5) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/build/directory/node_modules/.pnpm/@[email protected]/node_modules/@biomejs/biome/bin/biome'
  ]
}

Node.js v22.6.0

@ematipico
Copy link
Member

I'm not sure what's the issue here. You claim to have arm64 linux, so I would expect to see cli-linux-arm64, but Biome looks for cli-linux-x64. It seems there's something weird with your architecture.

Here's what the Node.js script uses for retrieving the info:

const { platform, arch, env, version, release } = process;

@anonrig can you help here?

@danlapid
Copy link

Ok I think I may understand part of the puzzle, I ran:

sh$ file /usr/local/bin/node
/usr/local/bin/node: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=b472bd6eda3fb7e5256dee43c06d732a89f538f4, for GNU/Linux 3.2.0, with debug_info, not stripped

So I seem to have x86_64 bit node on my arm64 vm (the vm is running on top of a mac with rosetta translation since I'm working on a project that only supports linux targets).
So it would seem that npm installs the system native binary version of package dependencies but biome uses the node process' architecture? Am I reading this right?

@danlapid
Copy link

@anonrig
Copy link
Contributor Author

anonrig commented Dec 11, 2024

One way of doing this is through SNAP_ARCH, to avoid running syscall on ubuntu 24/22

node -e "console.log(process.env)" | grep "64"
  SNAP_ARCH: 'amd64',

@danlapid
Copy link

I don't have that variable defined:

build@machine:~$ node -e "console.log(process.env)"
{
  SHELL: '/bin/bash',
  PWD: '/home/build',
  LOGNAME: 'build',
  XDG_SESSION_TYPE: 'tty',
  PNPM_HOME: '/home/build/.local/share/pnpm',
  MOTD_SHOWN: 'pam',
  HOME: '/home/build',
  LANG: 'C.UTF-8',
  LS_COLORS: 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.swp=00;90:*.tmp=00;90:*.dpkg-dist=00;90:*.dpkg-old=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:',
  LC_TERMINAL: 'iTerm2',
  SSH_CONNECTION: '192.168.65.1 59892 192.168.65.2 22',
  BAZEL_COMPLETION_USE_QUERY: 'true',
  LESSCLOSE: '/usr/bin/lesspipe %s %s',
  XDG_SESSION_CLASS: 'user',
  TERM: 'xterm-256color',
  LESSOPEN: '| /usr/bin/lesspipe %s',
  USER: 'build',
  LC_TERMINAL_VERSION: '3.5.10',
  SHLVL: '1',
  XDG_SESSION_ID: '147',
  XDG_RUNTIME_DIR: '/run/user/1000',
  SSH_CLIENT: '192.168.65.1 59892 22',
  LC_ALL: 'en_US.UTF-8',
  PATH: '/home/build/share/Cloudflare/depot_tools:/home/build/.cargo/bin:/home/build/.local/share/pnpm:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games',
  DBUS_SESSION_BUS_ADDRESS: 'unix:path=/run/user/1000/bus',
  SSH_TTY: '/dev/pts/6',
  _: '/usr/local/bin/node'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-Needs triage Status: this issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

4 participants