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

Download version indexes failure, version switch failure! #776

Closed
walnut-tom opened this issue Aug 14, 2023 · 6 comments
Closed

Download version indexes failure, version switch failure! #776

walnut-tom opened this issue Aug 14, 2023 · 6 comments

Comments

@walnut-tom
Copy link

Bug Report

Summary

n v8

curl: (22) The requested URL returned error: 502
Error: failed to download version index (https://npmmirror.com/mirrors/node/index.tab)

script returned exit code 2

Steps to Reproduce

Expected Behaviour

Ignore the error, and use local installed node.

Actual Behaviour

exit code 2

Other Information

Configuration Details

$ n --version
v9.1.0

$ command -v node
/usr/local/bin/node

$ node -p process.platform
linux

$ node -v
v18.16.1


@shadowspawn
Copy link
Collaborator

n uses the index.tab file to look up the available versions to expand incomplete versions like v8 and will fail if it is not available.

To install a local version without consulting index.tab, you can either:

  • use a full version, like n v18.16.1
  • select from local versions using the menu, just type n

@walnut-tom
Copy link
Author

walnut-tom commented Aug 14, 2023

Now, The following versions(10.24.1 12.22.12 14.21.3 16.20.1 18.16.1 8.17.0) has been installed locally.
image

I hope that when using n v16 to switch nodes, if the index file download fails, It can switch the locally installed 16.20.1 instead of directly exiting 2. If there is no node 16 locally installed, then directly exit 2.

I use n v8 in the script but not interactive.

@shadowspawn
Copy link
Collaborator

Ignoring the error would mean that the same command could install different versions depending on the internet connection. That is not something I want to do.

n ls lists the local versions. You could script installing a purely local version. Is that something that suits your use case?

A related issue including example script: #727 (comment)

@walnut-tom
Copy link
Author

ok. thank you!

@shadowspawn
Copy link
Collaborator

An answer was provided, and no further activity in a month. Closing this as resolved.

Feel free to open a new issue if it comes up again, with new information and renewed interest.

@shadowspawn
Copy link
Collaborator

Added --offline option in n v9.2.0

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

2 participants