Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser.
pip install nodejs-binNode.js PyPI distribution
Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser.
The nodejs-bin Python package redistributes Node.js so that it can be used as a dependency of Python projects. With nodejs-bin you can call nodejs, npm and npx from both the command line and a Python API.
Note: this is an unofficial Node.js distribution.
This is intended for use within Python virtual environments and containers, it should probably not be used for global installation.
This PyPI distribution is provided by https://github.com/samwillis/nodejs-pypi.
Install
To install:
pip install nodejs-bin
By default the command line node, npm and npx commands are not installed to prevent collisions with already installed Node.js versions. To install them:
pip install 'nodejs-bin[cmd]'
You can specify the Node.js version to install with:
pip install nodejs-bin==<version>
# Example:
pip install nodejs-bin==16.15.1
Command Line Usage
To run Node.js from the command line, use:
python -m nodejs
npm and npx are also available as nodejs.npm and nodejs.npx:
python -m nodejs.npm
python -m nodejs.npx
If you installed the optional command line commands with pip install 'nodejs-bin[cmd]' (see above), you can use them directly from the command line as you would normally with Node.js:
node
npm
npx
Python API Usage
node-bin has a simple Python API that wraps the Node.js command line with the Python subprocess.