Skip to content

How do I choose the latest node version? #61

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

Closed
samuelgozi opened this issue Sep 17, 2019 · 7 comments
Closed

How do I choose the latest node version? #61

samuelgozi opened this issue Sep 17, 2019 · 7 comments

Comments

@samuelgozi
Copy link

I'm sorry if this turns out to be a stupid question, but how do I choose the latest Node version available?
When generating stuff like code coverage(for example), it doesn't matter to me which Node version is used and I rather use the latest one.

@fregante
Copy link
Contributor

I was looking for this too but I think there's no way. The version seems to be passed to semver for validation and never once seems to refer to tags like latest/stable/lts etc

const c = semver.clean(versionSpec) || '';

@samuelgozi
Copy link
Author

samuelgozi commented Sep 20, 2019

@fregante Thanks for the help. I guess I'll have to set it manually, or just forget about it.

@fregante
Copy link
Contributor

fregante commented Sep 23, 2019

Solution

If you use a node docker image instead of setup-node, I think you can use node:current and node:lts (untested)

jobs:
  my_job:
    runs-on: ubuntu-latest
    container: node:latest
    steps:
    - run: npm install
    - run: npm test

Or you can use n, my go-to Node version installer:

jobs:
  my_job:
    runs-on: ubuntu-latest
    steps:
    - run: n stable
    - run: npm install
    - run: npm test

However the container: node:latest solution was 30 seconds faster for me

@samuelgozi
Copy link
Author

@fregante Thanks that might help!

@DanielRuf
Copy link

It would be the latest now.

See https://hub.docker.com/_/node?tab=description

grafik

@DanielRuf
Copy link

DanielRuf commented Jan 23, 2020

I checked it and '*' as Node version seems to work. Can you verify that?
We should document this and some more examples.

https://www.npmjs.com/package/semver/v/7.1.1#x-ranges-12x-1x-12-

@DanielRuf
Copy link

Running the docker container might not be a solution, especially when you have to run arbitrary docker commands as part of your tests which will fail then.

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