ch-nv
v1.0.3
Published
A CLI tool to temporarily use a specific Node.js version bundled in your package.
Readme
ch-nv (Change Node Version)
ch-nv — A CLI tool to temporarily use a specific Node.js version bundled in your package.
This lets you execute a script with your own bundled node (without needing to install nvm or n).
🚀 Installation
Install globally:
npm install -g ch-nv🔹 Project structure (after installation)
ch-vn/
├─ ch-nv.js
├─ node12.js
├─ node14.js
├─ node16.js
├─ node20.js
├─ npm12.js
├─ npm14.js
├─ npm16.js
├─ npm20.js
├─ npx12.js
├─ npx14.js
├─ npx16.js
├─ npx20.js
├─ node12/
├─ node14/
├─ node16/
├─ node20/
├─ package.json
📝 Usage
ch-nv [options] <your command or file>
node12 script.js
node14 script.js
node16 script.js
node20 script.js
npm12 install
npm14 install
npm16 install
npm20 install
npx12 create-react-app
npx14 create-react-app
npx16 create-react-app
npx20 create-react-app
🔹 Examples:
➥ Run server.js with Node 14:
ch-nv -14 server.js➥ Run index.js with Node 20 (default if not specified):
ch-nv index.js➥ Display package version:
ch-nv -v➥ Display help:
ch-nv -h🕹 CLI options:
| Flag | Meaning |
| ----- | ---------------------------------- |
| -v | Prints the ch-nv package version |
| -h | Shows help messages |
| -12 | Uses Node 12 |
| -14 | Uses Node 14 |
| -16 | Uses Node 16 |
| -20 | Uses Node 20 (default) |
🔹 How it works
➥ ch-nv prepends the specified node directory to your PATH.
➥ It then executes your script with that Node executable.
➥ The directory must be present alongside ch-nv.js.
🔹 Notes
✅ ch-nv is designed to work only on Windows.
✅ The directory structure must match:
✅ Each directory should have a node executable and related files.
📝 license
MIT
