Skip to content

fix: couldn't download node binary in Alpine, even if it exists in the mirror url#5972

Merged
jdx merged 7 commits intojdx:mainfrom
Hazer:fix/node-binary-404
Sep 6, 2025
Merged

fix: couldn't download node binary in Alpine, even if it exists in the mirror url#5972
jdx merged 7 commits intojdx:mainfrom
Hazer:fix/node-binary-404

Conversation

@Hazer
Copy link
Contributor

@Hazer Hazer commented Aug 10, 2025

I was trying to use in Alpine the following build:

https://unofficial-builds.nodejs.org/download/release/v24.5.0/node-v24.5.0-linux-x64-musl.tar.gz

So I set:

export MISE_NODE_MIRROR_URL=https://unofficial-builds.nodejs.org/download/release/
export MISE_NODE_FLAVOR=musl
export MISE_NODE_COMPILE=false

# and/or

mise settings set node.mirror_url https://unofficial-builds.nodejs.org/download/release/
mise settings set node.flavor musl
mise settings set node.compile 0

But mise install would always fail trying to download https://unofficial-builds.nodejs.org/download/release/v24.5.0/node-v24.5.0.tar.gz that don't exist.

The main issue was that my settings.node.compile false was being overridden by the distro all_compile override, and it would then try to download the source code for compilation, and fail, took me a long while to figure that out. The real fix was just avoiding the all_compile override if node.compile was set by the user manually. Added a info log to avoid future issues with not understand where this behavior came from.

The rest of the changes in plugins/core/node.rs are not necessary to solve the bug, but I would like to try pushing too:

  • I made a fetch_binary to reuse/deduplicate code for posix and windows, while at it made the logic about Ok explicit and about the NotFound case too; (while the diff looks horrible, imho the final code is clearer to reason and safer now, for someone new to the codebase)
  • it now makes explicitly clear when "precompiled node archive not found and compilation is disabled" happens.
  • Renamed install_compiled to install_compiling to make the intent of the method really clear, the first time I read the code I was confusing install_compiled and install_precompiled
  • Made the unarchiving logic reusable, I was thinking in moving to another place to let other packages use something like this, but it's just that for now;
  • Made sure the errors where not encapsulated by using Report::from (I had a bug because of it while testing stuff that shouldn't ever happen, making an Ok(()) be tested and treated as 404 somehow, but the previous flow allowed it when I made my broken test changes, so this could eventually cause a bug to some bad change in the future) removed by autofix
  • Added 2 info logs that would've been crucial to understand this issue.
  • Added more debug logging around the areas that eventually led me to discover the issue, and areas I was under the impression could be potential troublemakers.

The new install_precompiled and install_windows method bodies here for faster reading than the diff, just to try to defend my "unnecessary" changes easier 😆:

   async fn install_precompiled(
       &self,
       ctx: &InstallContext,
       tv: &mut ToolVersion,
       opts: &BuildOpts,
   ) -> Result<()> {
       match self
           .fetch_binary(ctx, tv, opts, || {
               self.extract_tarball(
                   &opts.binary_tarball_path,
                   &opts.install_path,
                   ctx,
                   1, // strip_components for binary tarball
               )
           })
           .await?
       {
           FetchOutcome::Downloaded => Ok(()),
           FetchOutcome::NotFound => {
               if Settings::get().node.compile != Some(false) {
                   self.install_compiling(ctx, tv, opts).await
               } else {
                   bail!("precompiled node archive not found and compilation is disabled")
               }
           }
       }
   }

   async fn install_windows(
       &self,
       ctx: &InstallContext,
       tv: &mut ToolVersion,
       opts: &BuildOpts,
   ) -> Result<()> {
       match self
           .fetch_binary(ctx, tv, opts, || self.extract_zip(opts, ctx))
           .await?
       {
           FetchOutcome::Downloaded => Ok(()),
           FetchOutcome::NotFound => bail!("precompiled node archive not found (404)"),
       }
   }

@jdx
Copy link
Owner

jdx commented Aug 11, 2025

bugbot run

cursor[bot]

This comment was marked as outdated.

@Hazer Hazer requested a review from jdx August 11, 2025 14:23
cursor[bot]

This comment was marked as outdated.

Hazer and others added 7 commits September 5, 2025 23:43
…when exists on custom mirror

The main issue was that my settings.node.compile false was being overridden by the distro all_compile override, but to get to the bottom of it I had a few bugs and weird behavior, so I restructured the installing portion of node while at it. The fix was avoiding the override if node.compile was set by the user manually in config/settings.rs.

The rest of the changes in plugins/core/node.rs, I made a fetch_binary to reuse code for posix and windows, made sure the errors where not encapsulated by using Report::from (I had a bug because of it while testing stuff that shouldn't happen), made the logic about Ok explicit and about the NotFound case too. Also made the unarchiving logic reusable, I was thinking in moving to another place to let other packages use something like this, but it's just that for now.
@Hazer Hazer force-pushed the fix/node-binary-404 branch from 6c451ce to be2ed44 Compare September 6, 2025 02:43
@Hazer Hazer requested a review from jdx September 6, 2025 03:13
@jdx
Copy link
Owner

jdx commented Sep 6, 2025

bugbot run

},
)?;
Ok(())
})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Missing Cleanup in Precompiled Install Path

The install_precompiled path is missing the file::remove_all(&opts.install_path) call that previously cleared the install directory before extraction. This omission can lead to stale files or installation failures when installing over an existing version. Other installation paths, like Windows or compiling from source, still include this cleanup.

Fix in Cursor Fix in Web

@jdx jdx merged commit 9c1cc11 into jdx:main Sep 6, 2025
18 checks passed
jdx pushed a commit that referenced this pull request Sep 6, 2025
### 🚀 Features

- **(backend)** improve http error when platform url missing; list
available platforms by @jdx in
[#6200](#6200)

### 🐛 Bug Fixes

- **(backend)** preserve arch underscores in platform keys by @jdx in
[#6202](#6202)
- **(task)** resolve hanging issue with multiple depends_post by @jdx in
[#6206](#6206)
- couldn't download node binary in Alpine, even if it exists in the
mirror url by @Hazer in [#5972](#5972)
- **breaking** use config_root for env._.path by @jdx in
[#6204](#6204)
- bugfix for paths that include spaces by @karim-elkholy in
[#6210](#6210)

### 📚 Documentation

- improve release notes generation by @jdx in
[#6197](#6197)
- fix release changelog contributor reporting by @jdx in
[#6201](#6201)

### Chore

- use fine-grained gh token by @jdx in
[#6208](#6208)
- use settings.local.json for claude config by @jdx in
[fd0fba9](fd0fba9)

### New Contributors

- @karim-elkholy made their first contribution in
[#6210](#6210)
- @Hazer made their first contribution in
[#5972](#5972)
@jdx jdx mentioned this pull request Sep 6, 2025
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Sep 8, 2025
## [2025.9.5](https://github.com/jdx/mise/compare/v2025.9.4..v2025.9.5) - 2025-09-06

### 🚀 Features

- **(task)** add timeout support for task execution by @jdx in [#6216](jdx/mise#6216)
- **(task)** sub-tasks in run lists by @jdx in [#6212](jdx/mise#6212)

### Chore

- fix npm publish action by @jdx in [14f4b09](jdx/mise@14f4b09)
- fix cloudflare release action by @jdx in [00afa25](jdx/mise@00afa25)
- fix git-cliff for release notes by @jdx in [15a9aed](jdx/mise@15a9aed)

## [2025.9.4](https://github.com/jdx/mise/compare/v2025.9.3..v2025.9.4) - 2025-09-06

### Chore

- fix git-cliff on release by @jdx in [3c388f2](jdx/mise@3c388f2)

## [2025.9.3](https://github.com/jdx/mise/compare/v2025.9.2..v2025.9.3) - 2025-09-06

### 🚀 Features

- **(backend)** improve http error when platform url missing; list available platforms by @jdx in [#6200](jdx/mise#6200)
- **(cli)** support scoped packages for all backend types by @earlgray283 in [#6213](jdx/mise#6213)
- **(http)** add URL replacement feature for HTTP requests by @ThomasSteinbach in [#6207](jdx/mise#6207)

### 🐛 Bug Fixes

- **(backend)** preserve arch underscores in platform keys by @jdx in [#6202](jdx/mise#6202)
- **(task)** resolve hanging issue with multiple depends_post by @jdx in [#6206](jdx/mise#6206)
- couldn't download node binary in Alpine, even if it exists in the mirror url by @Hazer in [#5972](jdx/mise#5972)
- **breaking** use config_root for env._.path by @jdx in [#6204](jdx/mise#6204)
- bugfix for paths that include spaces by @karim-elkholy in [#6210](jdx/mise#6210)

### 📚 Documentation

- improve release notes generation by @jdx in [#6197](jdx/mise#6197)
- fix release changelog contributor reporting by @jdx in [#6201](jdx/mise#6201)

### Chore

- use fine-grained gh token by @jdx in [#6208](jdx/mise#6208)
- use settings.local.json for claude config by @jdx in [fd0fba9](jdx/mise@fd0fba9)

### New Contributors

- @ThomasSteinbach made their first contribution in [#6207](jdx/mise#6207)
- @earlgray283 made their first contribution in [#6213](jdx/mise#6213)
- @karim-elkholy made their first contribution in [#6210](jdx/mise#6210)
- @Hazer made their first contribution in [#5972](jdx/mise#5972)

## [2025.9.2](https://github.com/jdx/mise/compare/v2025.9.1..v2025.9.2) - 2025-09-05

### 🐛 Bug Fixes

- **(ci)** set required environment variables for npm publishing by @jdx in [#6189](jdx/mise#6189)
- **(release)** clean up extra newlines in release notes formatting by @jdx in [#6190](jdx/mise#6190)
- **(release)** add proper newline after New Contributors section in cliff template by @jdx in [#6194](jdx/mise#6194)
- **(release)** fix changelog formatting to remove extra blank lines by @jdx in [#6195](jdx/mise#6195)
- **(release)** restore proper newline after New Contributors section by @jdx in [#6196](jdx/mise#6196)

### 🚜 Refactor

- **(ci)** split release workflow into separate specialized workflows by @jdx in [#6193](jdx/mise#6193)

### Chore

- **(release)** require GitHub Actions environment for release-plz script by @jdx in [#6191](jdx/mise#6191)

## [2025.9.1](https://github.com/jdx/mise/compare/v2025.9.0..v2025.9.1) - 2025-09-05

### 🐛 Bug Fixes

- python nested venv path order by @elvismacak in [#6124](jdx/mise#6124)
- resolve immutable release workflow and VERSION file timing issues by @jdx in [#6187](jdx/mise#6187)

### New Contributors

- @elvismacak made their first contribution in [#6124](jdx/mise#6124)

## [2025.9.0](https://github.com/jdx/mise/compare/v2025.8.21..v2025.9.0) - 2025-09-05

### 🚀 Features

- allow set/unset backend aliases by @roele in [#6172](jdx/mise#6172)

### 🐛 Bug Fixes

- **(aqua)** respect order of asset_strs by @risu729 in [#6143](jdx/mise#6143)
- **(java)** treat freebsd as linux (assuming linux compatability) by @roele in [#6161](jdx/mise#6161)
- **(nushell/windows)** Fix $env.PATH getting converted to a string by @zackyancey in [#6157](jdx/mise#6157)
- **(sync)** create uv_versions_path dir if it doesn't exist by @risu729 in [#6142](jdx/mise#6142)
- **(ubi)** show relevent error messages for v-prefixed tags by @risu729 in [#6183](jdx/mise#6183)
- remove nodejs/golang alias migrate code by @risu729 in [#6141](jdx/mise#6141)
- mise activate not working on powershell v5 by @L0RD-ZER0 in [#6168](jdx/mise#6168)

### 📚 Documentation

- **(task)** remove word "additional" to avoid confusions by @risu729 in [#6159](jdx/mise#6159)

### Chore

- update Cargo.lock by @risu729 in [#6184](jdx/mise#6184)

### New Contributors

- @zackyancey made their first contribution in [#6157](jdx/mise#6157)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants