{"id":543,"library":"nodeenv","title":"Node.js virtual environment builder","description":"Nodeenv is a Python tool that facilitates creating isolated Node.js environments, similar to how `virtualenv` manages Python environments. It allows developers to install specific Node.js versions and global npm packages within a dedicated directory, preventing conflicts between different projects. Currently at version 1.10.0, the library maintains an active development pace with several releases per year, incorporating new Python and Node.js version support, as well as bug fixes and improvements like UV virtual environment integration.","status":"active","version":"1.10.0","language":"python","source_language":"en","source_url":"https://github.com/ekalinin/nodeenv","tags":["nodejs","virtual environment","npm","development tools","cli"],"install":[{"cmd":"pip install nodeenv","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Commonly used Python virtual environment manager that nodeenv integrates with. Not a direct `pip` dependency, but required for the typical usage pattern of isolating Node.js within a Python virtual environment.","package":"virtualenv","optional":true},{"reason":"Nodeenv itself is a Python package and requires a compatible Python runtime to execute. Specific versions are required: !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7.","package":"python","optional":false}],"imports":[],"quickstart":{"code":"# First, create and activate a Python virtual environment\npython -m venv my_node_project\nsource my_node_project/bin/activate\n\n# Install nodeenv into the active Python virtual environment\npip install nodeenv\n\n# Create a Node.js virtual environment within the Python venv, installing a specific Node.js version\n# The --python-virtualenv (-p) flag integrates it with the current Python venv\nnodeenv --python-virtualenv --node=lts node_env\n\n# Note: nodeenv modifies the activation scripts. Reactivate the Python venv\n# or manually source the node_env/bin/activate script.\nsource my_node_project/bin/activate\n\n# Verify Node.js and npm versions\nnode -v\nnpm -v\n\n# Install a global npm package (e.g., `pnpm`)\nnpm install -g pnpm\n\n# Deactivate the node environment when done\ndeactivate_node\n# Then deactivate the Python virtual environment\ndeactivate","lang":"bash","description":"Nodeenv is primarily a command-line tool. The standard workflow involves setting up a Python virtual environment, installing `nodeenv` into it, and then using `nodeenv` to create a Node.js environment. The `--python-virtualenv` (or `-p`) flag integrates the Node.js environment directly into the currently active Python virtual environment, updating its activation scripts. After installation, reactivating the Python environment or sourcing the `node_env/bin/activate` script ensures the new Node.js environment is active."},"warnings":[{"fix":"Upgrade Python to 3.7+ or constrain `nodeenv` version to `<1.7.0` (e.g., `pip install nodeenv<1.7.0`).","message":"Version 1.7.0 of `nodeenv` dropped support for Python versions 3.4, 3.5, and 3.6. Users on these Python versions must either upgrade their Python environment or pin `nodeenv` to a version older than 1.7.0.","severity":"breaking","affected_versions":">=1.7.0"},{"fix":"Always `source /path/to/your_venv/bin/activate` before running `nodeenv -p`.","message":"When using `nodeenv --python-virtualenv` (or `-p`) to integrate Node.js into a Python virtual environment, ensure your Python virtual environment is active. Running the command without an active Python venv will result in a 'no python virtualenv is available' error, even if `nodeenv` itself is installed.","severity":"gotcha","affected_versions":"All"},{"fix":"Avoid `--ignore_ssl_certs` unless absolutely necessary and ensure you understand the security implications. Prefer setting up proper SSL certificates or using a trusted mirror if network issues persist.","message":"Using the `--ignore_ssl_certs` option can bypass SSL certificate verification, which poses a security risk. This option should only be used in trusted environments and with full understanding of the implications.","severity":"gotcha","affected_versions":"All"},{"fix":"Use the `--verbose` flag for detailed output or the `--prebuilt` flag to prefer pre-compiled Node.js binaries for faster installation (`nodeenv --prebuilt`).","message":"Initial `nodeenv` installation or Node.js compilation can appear to hang without output, especially on slower connections or when compiling from source. This is often due to large downloads or long compilation times.","severity":"gotcha","affected_versions":"All"},{"fix":"Execute shell commands directly in a shell (e.g., terminal or `.sh` script). If a shell command must be run from within a Python script, use Python's `subprocess` module (e.g., `subprocess.run(['python', '-m', 'venv', 'my_node_project'], check=True)`).","message":"Shell commands (like `python -m venv` or `nodeenv` commands) placed directly within a Python script will result in a `SyntaxError` when the script is executed. These commands are not valid Python syntax.","severity":"gotcha","affected_versions":"All"},{"fix":"To execute shell commands from within a Python script, use the `subprocess` module (e.g., `import subprocess; subprocess.run(['python', '-m', 'venv', 'my_node_project'], check=True)`) or `os.system()` (e.g., `import os; os.system('python -m venv my_node_project')`).","message":"Shell commands (like `python -m venv`) cannot be directly embedded and executed within a Python script. They must be executed using Python's `subprocess` module (e.g., `subprocess.run(['python', '-m', 'venv', 'my_node_project'], check=True)`) or `os.system('python -m venv my_node_project')`). Attempting to do so will result in a `SyntaxError`.","severity":"breaking","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-11T05:50:13.096Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Ensure Python's script directory (e.g., `C:\\PythonXX\\Scripts` or `C:\\Users\\YourUser\\AppData\\Roaming\\Python\\PythonXX\\Scripts`) is added to your system's PATH environment variable, then restart your terminal or IDE.","cause":"The `nodeenv` executable is not in the system's PATH environment variable, typically after a global pip installation on Windows without a system-wide PATH update, or if the terminal session hasn't been restarted.","error":"'nodeenv' is not recognized as an internal or external command, operable program or batch file"},{"fix":"Add the directory where `pip` installs scripts (e.g., `export PATH=$PATH:~/.local/bin` for Linux/macOS or the equivalent for your Python installation) to your shell's configuration file (e.g., `~/.bashrc`, `~/.zshrc`) and then `source` it or open a new terminal.","cause":"The `nodeenv` executable is not found in the shell's PATH. This usually occurs after installation if the Python script directory is not included in the shell's PATH, or if running on Linux/macOS and the installation location (e.g., `~/.local/bin`) is not sourced.","error":"nodenv: command not found"},{"error":"Command '['node', '-v']' failed with error code 1"},{"fix":"Activate your `nodeenv` environment using `source /path/to/your/env/bin/activate`. If the issue persists, try recreating the environment with a specific Node.js version using `nodeenv my_env --node=lts`.","cause":"After creating a `nodeenv` environment, the Node.js or npm executables are not being found because the `nodeenv` environment has not been activated, or the installation of Node.js within `nodeenv` failed.","error":"sh: node: command not found"},{"fix":"If behind a proxy, set `http_proxy` and `https_proxy` environment variables. For SSL certificate issues, try using the `--ignore-ssl-certs` flag when creating the environment: `nodeenv my_env --ignore-ssl-certs`.","cause":"`nodeenv` was unable to download the Node.js pre-built binaries, often due to network connectivity issues, corporate proxies, or SSL certificate problems preventing access to `nodejs.org`.","error":"Failed to download from https://nodejs.org/download/release/vX.X.X/node-vX.X.X-linux-x64.tar.gz"},{"fix":"First, activate your Python virtual environment (e.g., `source /path/to/my/python_venv/bin/activate`), then run `nodeenv -p` to install Node.js into it.","cause":"The `nodeenv -p` command is designed to install Node.js into an *existing and active* Python virtual environment, but no such environment is currently detected as active in your shell.","error":"no python virtualenv is available"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":0,"quickstart_tag":"stale","pypi_latest":null,"quickstart_checks":{"last_tested":"2026-04-23","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}}