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

Can n better determine the latest version of node when upstream downloads don't exist? #824

Closed
cviebrock opened this issue Nov 12, 2024 · 4 comments

Comments

@cviebrock
Copy link

cviebrock commented Nov 12, 2024

Problem

Node.js made some kind of mistake and published 18.20.5 without actually building the release files in the expected directory. See nodejs/node#55829. Any CI pipeline or tooling that uses n to download the latest 18.x version fails because of this. e.g.:

> if [ $DEV_MODE -eq 1 ]; then n --download engine && n exec engine yarn install; else n --download engine && n exec engine yarn install --production; fi
       found : /var/lib/jenkins/workspace/company_project_PR-2172/package.json
        read : ^18.13.0
      target : 18
  installing : node-v18.20.5
curl: (22) The requested URL returned error: 404 

  Error: download preflight failed for '18.20.5' (https://nodejs.org/dist/v18.20.5/node-v18.20.5-linux-x64.tar.xz)

Obivously this isn't an issue with n per-se ... but I'm wondering if there is something that could be done on the n side to not have errors like this affect users. I notice, for example, that https://nodejs.org/dist/latest-v18.x/ redirects/links to https://nodejs.org/dist/v18.20.4/, so maybe the way that n determines the latest version could be adjusted somehow?

Thanks!

Short Version

Is there a way to change n so that upstream issues like missing download files don't break users' pipelines?

Configuration Details

$ n --version
v9.2.3

$ command -v node
/Users/cmv/.n/bin/node

$ node -p process.platform
darwin
@Nxtra
Copy link

Nxtra commented Nov 13, 2024

Same issue here:

[Container] 2024/11/12 23:59:26.994824 Running command n 18
--
26 | installing : node-v18.20.5
27 | curl: (22) The requested URL returned error: 404
28 |  
29 | Error: download preflight failed for '18.20.5' (https://nodejs.org/dist/v18.20.5/node-v18.20.5-linux-x64.tar.xz)

@shadowspawn
Copy link
Collaborator

shadowspawn commented Nov 13, 2024

This may have been fixed already on the node side. Node.js just switched over to a new distribution method (using CloudFlare) within the last couple of weeks, and this might have been a teething problem with the new setup.

My usual expectation is that index.tab is the source of truth for what is available.

Thanks for node issue link. I have subscribed there to follow developments.

@shadowspawn
Copy link
Collaborator

For historical interest, switched from web page scraping to using index.tab here: #578

@shadowspawn
Copy link
Collaborator

This was a transient problem due to a (hopefully) one-off problem with the new Node.js CDN and release process.

In general, n trusts the available meta-data. And almost always, that is accurate!

One general-purpose idea I had was adding an option for a cool-down period to skip over recent releases.

I don't think there is a common enough problem with a good enough solution to act on for this issue.

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

No branches or pull requests

3 participants