Schniz / fnm

🚀 Fast and simple Node.js version manager, built in Rust
https://fnm.vercel.app
GNU General Public License v3.0
17.8k stars 454 forks source link

Arch detection override #239

Open takase1121 opened 4 years ago

takase1121 commented 4 years ago

I am running fnm on Alpine, meaning no glibc thus official node.js build can't be used. I set the appropriate mirror env variable to the unofficial one, but it still fails to install because my arch is x64 but the unofficial build has -musl appended onto that. Hopefully a flag to override that can be added

Schniz commented 4 years ago

It is not currently supported. Sorry! But it is interesting.

Schniz commented 4 years ago

I set the appropriate mirror env variable to the unofficial one

would you mind sharing the unofficial mirror? 😄

takase1121 commented 4 years ago

Website: https://unofficial-builds.nodejs.org

Mirror: https://unofficial-builds.nodejs.org/download/

Schniz commented 3 years ago

(taken from #274 comment:)

Potentially refactor for #239, most of this will be used in cfg! if statements instead of #[cfg] and maybe we'll have a PLATFORM constant that we can unit test, with the following possible values:

enum OsPlatform {
  Arm32,
  Arm64,
  X86,
  X64,
}

Here are some docs regarding #[cfg] and cfg!, and here's an example:

#[cfg(unix)]
fn this_fn_will_only_be_compiled_on_unix() {
  println!("Hello, Unix!");
}

#[cfg(not(unix))]
fn this_fn_will_not_be_compiled_on_unix() {
  println!("Hello, Windows!");
}

# Can be written like:

fn this_fn_will_always_compile() {
  if cfg!(unix) {
    println!("Hello, Unix!");
  } else {
    println!("Hello, Windows!");
  }
}

This will not fix this issue entirely, but it will be a start that will help us replace the arch result to a custom environment variable, if set.