Skip to content

Request: Allow version ranges #152

Closed

Description

@xi

It would be great if I could define version ranges instead of exact versions, e.g. 4.x or ^4.3.1. It is probably best to use npm syntax for these ranges.

Activity

  1. dev-zero commented on Jan 11, 2021

    @dev-zero

    specifically, it would be awesome if nodeenv could take a version range and only install a full nodeenv if the system-provided one doesn't satisfy the version requirement...

  2. jstucke commented on May 2, 2024

    @jstucke

    It would be nice for scripting the installation if requirement specifiers were supported (like for pip packages) for specifying nodejs/npm versions:

    nodeenv --node ">=20.0.0"
    nodeenv --node "~=22.0.0"
    nodeenv --node "<21.0.0"

    Furthermore, it would also be nice to be able to just specify the major (and optionally minor) version (to install the latest one that matches):

    nodeenv --node 22
    nodeenv --node 21.7

    You can easily hack something together to script this, e.g.

    import re
    import subprocess
    from packaging.version import parse
    from shlex import split
    
    
    def set_up_node(nodejs_version: str = "22"):
        subprocess.run(split("nodeenv --list"), capture_output=True, text=True)
        available_versions = [
            parse(v) for v in re.split(r"[\n\t ]", proc.stderr)
            if v and v.startswith(nodejs_version)
        ]
        subprocess.run(split(f"nodeenv env --node={max(available_versions)} --prebuilt"))
        subprocess.run(f". env/bin/activate && npm install --no-fund .", shell=True)

    but it would be nice if nodeenv could do this for you

  3. added a commit that references this issue on Aug 14, 2026
    13ccc0b
  4. added a commit that references this issue on Aug 14, 2026
    bb12812
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions