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

Show n-install for installing n on Node.js downloads page #829

Open
shadowspawn opened this issue Feb 1, 2025 · 10 comments
Open

Show n-install for installing n on Node.js downloads page #829

shadowspawn opened this issue Feb 1, 2025 · 10 comments
Assignees
Labels
docs Changes to README or other documentation

Comments

@shadowspawn
Copy link
Collaborator

Node.js has a new download page where users can get instructions on how to install Node.js in various ways:

I am thinking about adding instructions for n, and think n-install might be the most self-contained way of installing n for new users.

Some related PRs:

Preflight issue on n-install:

@shadowspawn
Copy link
Collaborator Author

shadowspawn commented Feb 8, 2025

Draft text:

Image
Raw text

# For more about n-install: https://github.com/mklement0/n-install
# For more about n, including other ways to install: https://github.com/tj/n

# Download and install n using n-install:
curl -L https://bit.ly/n-install | bash -s -- -

# Open a new terminal tab/window, or reload your shell initialization file

# Download and install Node.js:
n install 22

# Verify the Node.js version:
node -v # Should print "v22.13.1".

# Verify npm version:
npm -v # Should print "10.9.2".

@shadowspawn
Copy link
Collaborator Author

To see running locally, clone https://github.com/shadowspawn/nodejs.org/

And run:

cd nodesjs.org
git switch add-n-download-method
npm run build && npm run start

@shadowspawn
Copy link
Collaborator Author

I added explicit mention of the two home pages, since otherwise would be easy to assume that n-install is just part of n and miss the extra project and information available. I suppressed the n-install auto-install of Node.js so could show using n directly and so could use the major version like other package managers.

Any suggestions @mklement0 ?

For comparison fnm shows:

# Download and install fnm:
curl -o- https://fnm.vercel.app/install | bash

# Download and install Node.js:
fnm install 22

# Verify the Node.js version:
node -v # Should print "v22.13.1".

# Verify npm version:
npm -v # Should print "10.9.2".

@mklement0
Copy link
Contributor

Thanks, @shadowspawn.

Makes sense to make the instructions consistent, though I suggest perhaps adding a comment such as the following after
# Download and install using n-install:

# Omit the trailing '-' to instantly install the latest LTS version or specify version number(s) instead.
# Append -y to skip the confirmation prompt.

@shadowspawn
Copy link
Collaborator Author

shadowspawn commented Feb 9, 2025

Fair suggestions, thanks.

I have been considering the instructions the last week, so a way longer reply than you might expect, with a bit of a mind dump on why I am leaning towards not adding more explanations. I have not used n-install other than experimentally and far from a new Node.js user, so feel free to come back with insights I missed.

  1. The other download methods are very concise, and I am guided by the existing style.

  2. # Omit the trailing '-' to instantly install the latest LTS version or specify version number(s) instead.

I did experiment with supplying a version to n-install, but:

  • the download page is for a particular version (so LTS not always relevant to the page). I was pleased to see that n-install has LTS in the new-user tips after the successful install, so user does find out lts exists as a version target. Credit to n-install.
  • I tried using major version like in the other download methods and n-install wanted full specified version, so again different pattern than other download methods
  • I prefer doing the Node.js install using n so n and the install are explicit
    • user will be using n for future installs
    • all the other download methods have a Node.js install step
    • vested interest as n maintainer, I want n to appear in instructions!

On the converse, I did wonder about suggesting that n-install be much more concise about the versions when skipping the install. However, I expect not the typical usage forn-install, so you may not want to do.

Afterwards, THE FOLLOWING Node.js VERSION(S) WILL BE INSTALLED,
and the first one listed will be made active; 
  'lts' refers to the LTS (long-term support) version, 
  'latest' to the latest available version.
  '-' means that *no* version will be installed:

  NOTE: Skipping Node.js installation, as requested.
  1. # Append -y to skip the confirmation prompt.

I didn't realise there was going to be a confirmation when I first tried n-install, and I like it. Shows me what it is going to do, and now I have the details, I can make an informed consent. (Also makes up for the download page instructions leaving out details 🙊 since n-install itself goes into the detail 🧑‍🎓 )

I feel like suppressing the prompt is an automation thing, and not the focus of the download page. So people should go look at the n-install home page for that sort of thing.

@mklement0
Copy link
Contributor

The other download methods are very concise, and I am guided by the existing style.

Understood; if adding a 2-line comment strikes you as too verbose, the rest of this comment is moot.

I tried using major version like in the other download methods and n-install wanted full specified version, so again different pattern than other download methods

I just updated n-install to support major-version-only specifications too, such as 22

I prefer doing the Node.js install using n so n and the install are explicit

Understood, which is why I suggested adding a comment only.

I did wonder about suggesting that n-install be much more concise about the versions when skipping the install

I've just updated n-install to remove the boilerplate information in the interactive prompt when opt-outs are specified (- as the version operand, -n to suppress initialization-file updating).

I feel like suppressing the prompt is an automation thing

Personally, even for interactive use, I always want to know how to skip confirmation prompts, so this isn't just about scripted (automation) use.

Again, my suggestion is merely to mention it in a comment.


Having said all that, I do understand your desire to keep things consistent, concise, and presumably not to give special treatment to individual installation methods.

Whatever you decide, I appreciate your efforts, and also for inspiring me to make some improvements.

@shadowspawn
Copy link
Collaborator Author

I've just updated n-install to remove the boilerplate information in the interactive prompt when opt-outs are specified (- as the version operand, -n to suppress initialization-file updating).

Woop! Thanks.

@shadowspawn
Copy link
Collaborator Author

I played about with this at length again now that n-install can specify the version using major.

I think the current style of the Node.js download page is that you get Node.js downloaded once, and then you don't use these instructions again because you use whatever tool you installed.

As such, the n-install one-shot is a good fit for the getting-started situation, and I downgraded the n usage to a comment.

Image

@mklement0
Copy link
Contributor

Great - thank you.

@shadowspawn
Copy link
Collaborator Author

Opened PR: nodejs/nodejs.org#7498

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Changes to README or other documentation
Projects
None yet
Development

No branches or pull requests

2 participants