Provide a output for the selected Node.js version
See original GitHub issueIt would be great if there could be an output that tells which exact version of Node.js was installed.
An example use case for this is cacheing node_modules
, which is only valid for the same OS + Node.js version + package-lock combination:
name: Node CI
on:
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v1
with:
node-version: 12.15.0
- name: Cache dependencies
id: cache-node-modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-node-${{ steps.setup-node.outputs.node-version }}-modules-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
run: npm ci
if: steps.cache-node-modules.outputs.cache-hit != 'true'
- name: Tets
run: npm test
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:10 (5 by maintainers)
Top Results From Across the Web
How can I specify the required Node.js version in package.json?
You can set the engines field in your package.json and set requirements for either node or npm versions or both: "engines" : {...
Read more >Verify a Specific Node Version for Your JavaScript Project
To verify the node version per JavaScript project, I found this npm package check-node-version. It allows you to verify the node version via...
Read more >Process | Node.js v19.3.0 Documentation
The process object provides information about, and control over, the current Node.js process. import process from 'node:process'; ...
Read more >Selecting the node.js version in Windows Azure Web Sites
The node.js version desired by your application is specified in the package.json file using the same mechanisms NPM uses. If no version is ......
Read more >Debug Node.js Apps using Visual Studio Code
Make sure to have those Node.js versions installed that you want to use with the runtimeVersion attribute, as the feature will not download...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
#173 implements this.
@simondotm The devil is in the details of how you’re trying to use the Node version so that may be good enough in some cases, but using
strategy.matrix
will only give you the string of the currently active matrix value. What we’re after here is the exact Node version that was installed as an output.I’ll again note that
setup-python
already does this. Whysetup-node
doesn’t do the same is baffling.