Skip to content

NVM fails to install node when passed a SemVer range. #42543

Description

@Shadaan786

Description:

When a semantic version range such as >=22.22.3 <23 || >=24.15.0 <25 is passed to NVM then NVM fails to install the Node.js because the value of engines.node in package.json is a semantic version range, while development environment needs to pass a concrete Node.js version to nvm install rather than a range of version, also the unquoted command substitution causes bash to interpret the parts of semantic version range as shell operators resulting in errors such as:

3.269 bash: line 1: 23: No such file or directory
3.270 bash: line 1: 25: No such file or directory

Because bash interprets < to take input from a file or can say input redirection operator.

Steps to reproduce:

  1. Start a dev container using .devcontainer/Dockerfile or create a github codespaces.
  2. During the container build, the Node.js version is read from engines.node in package.json.
  3. The resulting semantic version range is passed to nvm install.
  4. Observe the No such file or directory errors as mentioned above.

Expected behavior:

No errors like No such file/directory or not being ended in recovery container, the Dockerfile should be builded successfully.

Actual behavior:

Image

The error logs shows up when buildng the container using node semantic versioning range or in github codespaces, which results in failure to build the container or end up in recovery container in codespaces.

Server Setup Information:

  • Version of Rocket.Chat Server: N/A
  • License Type: N/A
  • Number of Users: N/A
  • Operating System: Ubuntu 22.04.5 LTS
  • Deployment Method: Docker / Dev container / github codespaces
  • Number of Running Instances: N/A
  • DB Replicaset Oplog: N/A
  • NodeJS Version: 24.15.0
  • MongoDB Version: N/A

Additional context

The issue was reproduced locally by passing the value of engines.node to nvm install in .gitpod/.gitpod.yml and .devcontainer/Dockerfile

Relevant logs:

bash: line 1: 23: No such file or directory
bash: line 1: 25: No such file or directory

Activity

  1. schizophrenicmaniac commented on Oct 3, 2026

    @schizophrenicmaniac

    Hi, I'd like to work on this. The devcontainer Dockerfile and .gitpod.yml pass engines.node (a range) to nvm install unquoted. I'd switch both to the exact version in volta.node, which the setup-node CI action already reads, and quote the substitution.

  2. Shadaan786 commented on Oct 3, 2026

    @Shadaan786
    Author

    @schizophrenicmaniac I'm glad to hear that but I already did it, just submitting the PR.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions