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:
- Start a dev container using .devcontainer/Dockerfile or create a github codespaces.
- During the container build, the Node.js version is read from engines.node in package.json.
- The resulting semantic version range is passed to nvm install.
- 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:
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
Description:
When a semantic version range such as
>=22.22.3 <23 || >=24.15.0 <25is passed to NVM then NVM fails to install the Node.js because the value ofengines.nodein package.json is a semantic version range, while development environment needs to pass a concrete Node.js version tonvm installrather 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:Because bash interprets
<to take input from a file or can say input redirection operator.Steps to reproduce:
Expected behavior:
No errors like No such file/directory or not being ended in recovery container, the Dockerfile should be builded successfully.
Actual behavior:
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:
Additional context
The issue was reproduced locally by passing the value of
engines.nodetonvm installin .gitpod/.gitpod.yml and .devcontainer/DockerfileRelevant logs: