Nave (Node Virtual Environments) is a command-line tool designed for managing multiple Node.js versions and their associated global npm package installations. It operates by spawning isolated subshells, allowing users to switch Node.js versions and their global npm environments on a per-session or per-project basis without permanently altering system-wide shell configurations like `.bashrc` or `.profile`. As of version 3.5.6, Nave functions primarily as a Bash script, differentiating it from Node.js-based version managers. Its installation can be achieved by simply downloading the `nave.sh` script or via a global npm installation, which essentially symlinks the script. The project's release cadence is irregular, reflecting maintainer-driven updates rather than a fixed schedule. A key advantage is its lightweight nature and reliance on standard shell features for environment isolation.
npm install naveNo compatibility data collected yet for this library.
This quickstart demonstrates the installation of the Nave shell script, listing remote Node.js versions, installing and switching to a specific version within a temporary subshell, installing a global npm package, and managing named Node.js environments. Note that these are shell commands, not JavaScript code, executed in the context of Node.js development.
Always remember that `nave use` creates a temporary environment. For persistent changes across all your terminal sessions, consider using `nave usemain <version>`, or for project-specific auto-switching, configure a `.naverc` file and use `nave auto`.
Understand that Nave's operations are command-line based shell functions. Its internal workings and troubleshooting are often related to shell environments (PATH, permissions, subshells) rather than Node.js module resolution or JavaScript execution.
If you intend for a Node.js version to be your default across all new terminal sessions, use `nave usemain <version>`. Be aware that this command may require `sudo` privileges depending on your system's `/usr/local` permissions.
Continue using `npm install` or `yarn install` within your project directories after switching to a desired Node.js version with Nave to manage project-specific dependencies.
Ensure the `nave.sh` file (e.g., downloaded to `/usr/local/bin/nave`) has execute permissions (`chmod 0755 /usr/local/bin/nave`) and that its containing directory is included in your shell's PATH. If installed via npm, verify `npm bin -g` is in your PATH.
If you want a Node.js version to be the default for all new terminal sessions, use `nave usemain <version>`. For project-specific, persistent environment switching, configure a `.naverc` file and use `nave auto`.
This often means the `npm` prefix within the Nave environment is incorrectly configured. Ensure `npm config get prefix` inside the `nave` subshell points to a user-owned directory within your Nave installation (e.g., `~/.nave/node/<version>/`). If not, you might need to reinstall the Node version via Nave, or manually configure the npm prefix using `npm config set prefix ~/.nave/node/$(nave get version)/lib/node_modules` (adjust path as necessary).