jorgebucaran / nvm.fish

The Node.js version manager you'll adore, crafted just for Fish
https://git.io/nvm.fish
MIT License
2.13k stars 71 forks source link

Attempt install from source when pre-built binary download fails #142

Closed LeeroyDing closed 3 years ago

LeeroyDing commented 3 years ago

Fixes #127

LeeroyDing commented 3 years ago

I'm not very familiar with fish... How do I add an option for nvm install -s $version?

jorgebucaran commented 3 years ago

For parsing options, you usually want to use the argparse built-in.

jorgebucaran commented 3 years ago

Let's write a function, say _nvm_build_from_source that builds Node from the source. I'll look into integrating it into nvm.

LeeroyDing commented 3 years ago

Sounds good, let me move it to a function to use later

LeeroyDing commented 3 years ago

The installation is essentially 4 steps:

  1. Download the source tarball and extract it to a temp folder.
  2. Run ./configure --prefix="$INSTALLATION_TARGET", in our case $nvm_data/$v.
  3. make with -jN, where N=number of cores + 1. Building without -j will work too, but is a lot slower. I haven't added the core count detection.
  4. Run make install to install the compiled binary into the previously specified prefix location.
jorgebucaran commented 3 years ago

I feel this opens up too big a can of worms, sorry. Thank you for working on this PR, but I won't be adding this feature.