Skip to content

Support devEngines field in package.json #1255

Closed

Description

@zanminkian

Description:
devEngines field is now supported by npm and corepack.

If user set node-version-file: package.json in yaml, setup-node action should consult both engines and devEngines fields, while currently only engines works.

Justification:
In monorepo, the root package.json usually have no engines field. Moreover, the engines is for users who install the npm package, while the devEngines field is for who developers who develop the npm package. Obviously, devEngines is more suitable for setup-node.

Are you willing to submit a PR?
Yes

Activity

  1. suyashgaonkar commented on Mar 24, 2025

    @suyashgaonkar
    Contributor

    Hi @zanminkian , Thank you for creating this feature request. We will investigate it and provide feedback as soon as we have some updates.

  2. mklueh commented on Apr 13, 2025

    @mklueh

    And if anyone is working on this, maybe you could also consider factoring in the volta node field?

    Image

    Then you could run volta pin node@23.11.0 which would fetch and install node, set the node version in package.json volta.node and that's all you have to do

    https://docs.volta.sh/reference/pin

    But maybe it would be better to let volta handle the devEngines update instead of making this action volta-aware

  3. susnux commented on Apr 20, 2025

    @susnux
    Contributor

    @mklueh but the volta field is already supported? #921

  4. zanminkian commented on Jul 30, 2025

    @zanminkian
    Author

    @mklueh volta is not the standard, but devEngines is the standard which is supported by npm, pnpm, corepack ...
    BTW I don't consider volta until it stablely supports pnpm.

  5. zanminkian commented on Dec 19, 2025

    @zanminkian
    Author

    Here is a workaround to support devEngines:

          - uses: actions/checkout@v4
          # TODO: Remove this step when https://github.com/actions/setup-node/pull/1283 is merged
          - name: Get Node.js version
            id: get-node-version
            run: |
              node_version=$(jq -r '.devEngines.runtime.version // empty' package.json)
              if [ -z "$node_version" ]; then
                echo "Error: No Node.js version specified in devEngines.runtime.version"
                exit 1
              fi
              echo "node-version=$node_version" >> $GITHUB_OUTPUT
          - uses: actions/setup-node@v4
            with:
              node-version: ${{ steps.get-node-version.outputs.node-version }}
  6. v-aparnajyothi-y commented on Jan 28, 2026

    @v-aparnajyothi-y
    Contributor

    Hello Everyone, Thanks for the detailed feedback and examples shared here. Based on the discussion and internal review, we agree this would be a useful enhancement with minimal impact on existing workflows.

    We’re planning to extend node-version-file: package.json to also consider devEngines, with the following precedence:

    volta.node → devEngines.runtime → engines.node

    This keeps the current behavior unchanged unless devEngines (or volta) is explicitly defined, while better supporting developer-focused and monorepo setups. We’ll ensure the precedence is clearly documented and will share updates as the implementation progresses.

    Please feel free to reach if you have any questions or concerns regarding this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature or request to improve the current logic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions