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

Provide working recommendation for contributor Node.js switching #26441

Closed
MikeMcC399 opened this issue Apr 6, 2023 · 8 comments · Fixed by #26652
Closed

Provide working recommendation for contributor Node.js switching #26441

MikeMcC399 opened this issue Apr 6, 2023 · 8 comments · Fixed by #26652
Labels
type: enhancement Requested enhancement of existing feature

Comments

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Apr 6, 2023

What would you like?

I would like to be able to follow the recommendations in CONTRIBUTING: Requirements to switch Node.js.


Requirements

You must have the following installed on your system to contribute locally:

  • Node.js (See the root .node-version file for minimum version requirements. You can use avn to automatically switch to the right version of Node.js for this repo.)

Why is this needed?

This is convenient when contributing to multiple Cypress repositories with different Node.js requirements.

Other

The recommendation to use avn is outdated. It no longer works.

  • The issues list https://github.com/wbyoung/avn/issues indicate that it is incompatible with the versions of Node.js supported by the current version of Cypress i.e. Node.js 14 and later.
  • I tried it on Ubuntu 22.04 with nvm v0.39.3 and it shows errors when installing and does not switch Node.js when changing to a directory containing .node-version.
  • The last update to the repository avn was three years ago.

Suggestion

Either:

  • recommend a substitute for avn which is compatible with Node.js 14 and later or
  • consider switching to using .nvmrc which is compatible with the POSIX-shell version of nvm. See .nvmrc.

Related discussion

This follows on from cypress-io/github-action#853 (comment) from @emilyrohrbough which drew my attention to this section.

@MikeMcC399
Copy link
Contributor Author

@nagash77 nagash77 added type: enhancement Requested enhancement of existing feature external: documentation labels Apr 6, 2023
@shadowspawn
Copy link

For interest, there are a variety of node-version managers which support the .node-version file: https://github.com/shadowspawn/node-version-usage

(nvm does not directly support changing node when change directory, and does not support the .node-version file.)

@lmiller1990
Copy link
Contributor

I have been using n - here to manager my Node.js versions. It works with .node-version and .nvmrc by the looks of things.

@MikeMcC399
Copy link
Contributor Author

@lmiller1990 / @emilyrohrbough

Is there consensus to recommend that contributors to this repo use:

  • n (n – Interactively Manage Your Node.js Versions) instead of the outdated
  • avn (Automatic Version Switching for Node.js)?

(I bet that would please @shadowspawn 😃!)

I can't weigh in on this at the moment since I have been using nvm on Ubuntu and nvm-windows on Windows 11.

If n (n – Interactively Manage Your Node.js Versions) is considered the tool of choice for POSIX-based systems then I would migrate and submit a PR to document this.

For Windows (where I am not using WSL2) I would stay with nvm-windows. But in any case I had extreme issues trying to build Cypress on Windows and I have abandoned it for that use-case, although it is perfectly good for other repos.

@lmiller1990
Copy link
Contributor

lmiller1990 commented May 1, 2023

Do we need to make a recommendation? I think most developers probably prefer to decide how they'd like to manage their Node.js version on their own. WDYT? We could add a list - eg "You need to use Node.js version XXX, here are some tools you can consider which will help manage the Node.js versions your machine has installed".

@MikeMcC399
Copy link
Contributor Author

If you don't want to make a specific recommendation, then my suggestion for a replacement text would be:


Requirements

You must have the following installed on your system to contribute locally:

@MikeMcC399
Copy link
Contributor Author

I tried out n (n – Interactively Manage Your Node.js Versions) on Ubuntu and found it was better than nvm in respect to pnpm and Yarn in that I did not need to reinstall the other package managers globally after installing a new Node.js version. So I plan to use n on Ubuntu in future. (I need all three package managers (npm, pnpm and Yarn) when I'm working on cypress-io/github-action).

@MikeMcC399
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Requested enhancement of existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants