question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide a output for the selected Node.js version

See original GitHub issue

It 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:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
panvacommented, May 21, 2021

#173 implements this.

2reactions
rdmurphycommented, May 21, 2021

@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. Why setup-node doesn’t do the same is baffling.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found