This tool helps you manage Node.js versions using nvm (Node Version Manager). It allows you to install, switch, and automatically manage Node.js versions based on a .nvmrc file.
Managing multiple Node.js versions can be challenging, especially when working on different projects that require different versions. This tool simplifies the process by leveraging nvm to create isolated Node.js environments. With this tool, you can easily install specific Node.js versions, switch between them, and automatically use the version specified in a .nvmrc file.
- Install Node.js versions: Easily install specific Node.js versions using
nvm. - Switch Node.js versions: Switch between different Node.js versions and update the
.nvmrcfile. - Automatic management: Automatically install and use the Node.js version specified in the
.nvmrcfile. - Cross-platform: Supports Windows, Linux, and macOS.
-
Clone the repository:
git clone https://github.com/Victor1890/node-venv.git cd node-env -
Install dependencies using
pnpm:pnpm install
If you don't have
pnpminstalled, you can install it usingnpm:npm install -g pnpm
-
Make sure
nvmis installed on your system. You can follow the instructions below for your operating system:
- Download the
nvm-setup.exefrom the nvm-windows releases page. - Run
nvm-setup.exe. - Follow the installation instructions.
- Open your terminal.
- Run the following command to install
nvm:curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash - Add the following lines to your profile (
~/.bashrc,~/.zshrc,~/.profile, or~/.bash_profile):export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
- Restart your terminal or run the following command to apply the changes:
source ~/.bashrc
For more details, visit the official nvm GitHub page.
You can use the tool with the following commands:
To install a specific Node.js version using nvm, run:
node-env install <nodeVersion>Example:
node-env install 14.17.0To switch to a specific Node.js version and update the .nvmrc file, run:
node-env use <nodeVersion>Example:
node-env use 16.13.0To automatically install and use the Node.js version specified in the .nvmrc file, run:
node-env autoYou can configure the application name by setting the APP_NAME environment variable. The default value is node-venv.
This project is licensed under the MIT License.