Skip to content

.nvmrc with non-default Node.js version does not work #3016

Description

@patarapolw

pnpm version:

5.13.5

Code to reproduce the issue:

nvm install 12
nvm install 14
nvm alias default 12
echo '14' > .nvmrc
nvm use
echo 'engine-strict=true' >> .npmrc
# add `engineStrict: true` in `package.json` also works

Then, add engines field in package.json.

{
  "engines": {
    "node": "14"
  }
}

Expected behavior:

No errors, install successfully.

Actual behavior:

❯ pnpm i
 ERROR  Your Node version is incompatible with "/home/patarapolw/projects/aloud-comments".

Expected version: 14
Got: v12.19.0

This is happening because the package's manifest has an engines.node field specified.
To fix this issue, install the required Node version.

Another way to reproduce

  • Remove engine-strict=true
  • Add node --version to scripts section
Found '/home/patarapolw/projects/aloud-comments/.nvmrc' with version <14>
Now using node v14.15.1 (npm v6.14.8)
❯ pnpm node:version

> aloud-comments@0.2.3 node:version /home/patarapolw/projects/aloud-comments
> node --version

v12.19.0

Yet another way to reproduce

  • pnpm i @stencil/core
Found '/home/patarapolw/projects/aloud-comments/.nvmrc' with version <14>
Now using node v14.15.1 (npm v6.14.8)
❯ pnpm serve
> aloud-comments@0.2.3 serve /home/patarapolw/projects/aloud-comments
> stencil build --dev --watch --serve
Your current version of Node is v12.19.0, however Stencil's recommendation is v14.5.0 or greater. Note that future versions of Stencil will eventually remove support for non-LTS Node versions and an Active LTS version is recommended (https://nodejs.org/en/about/releases/).

Of course, Stencil team said it's your bug; not theirs.

Additional information:

  • Windows, macOS, or Linux?: Ubuntu 20.04 on WSL2
❯ node -v
v14.15.1
❯ cat /proc/version
Linux version 4.19.128-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Tue Jun 23 12:58:10 UTC 2020
❯ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:        20.04
Codename:       focal

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions