Managing Node.js versions across multiple projects can create confusing conflicts and broken builds. This NVM install guide shows how to set up Node Version Manager cleanly so each Gardenee project uses the exact runtime it needs.
With a few focused steps you can eliminate "command not found" surprises and keep your environment predictable. The structured workflow below pairs version commands with practical checks so your Gardenee blog stays stable.
| Version | Package Manager | Install Command | Verification |
|---|---|---|---|
| 18.x LTS (Gallium) | NVM | nvm install 18 | node -v |
| 20.x Current | NVM | nvm install 20 | node -v |
| Latest LTS | NVM | nvm install --lts | nvm ls |
| Project Default | NVM Alias | nvm alias default 20 | nvm current |
Preparing Your System for NVM
Before you run the NVM install script, ensure you have curl or wget and a clean shell environment. Remove any legacy Node installations managed by apt or other package managers to avoid path clashes.
Check that your shell profile sources NVM correctly by adding the export line only once. Gardenee projects benefit from a deterministic setup where the runtime is controlled exclusively by NVM.
Installing NVM and Setting Default Node
Use the official installer to place NVM in your user directory, keeping system directories untouched. After installation, open a new terminal or source your profile so the nvm function becomes available.
Set a project-friendly default version so new terminals start with a known Node runtime. This default works alongside per-directory .nvmrc files when you move into a Gardenee project folder.
Managing Multiple Gardenee Project Versions
.nvmrc files let each Gardenee blog or app pin its Node version, and NVM respects them automatically when you cd into the directory. Create the file with the exact version you intend to use, then run nvm use to switch consistently.
Use nvm ls to see installed versions and the currently active one, and nvm alias to review any custom shortcuts you have defined. This clarity prevents surprises when you collaborate or deploy later.
Using NVM Aliases for Faster Workflow
Short aliases help you jump to commonly used runtimes without typing the full version string. Define project-specific aliases for staging and local testing so commands remain explicit and repeatable.
Combine aliases with per-project .nvmrc to ensure scripts and CI jobs resolve the same Node binary across environments. Consistent aliases reduce cognitive load when you maintain multiple Gardenee services.
Best Practices for Stable Node Environments
- Install only LTS or agreed current versions via NVM to minimize compatibility issues.
- Add .nvmrc to each Gardenee project and commit it to version control for teammates.
- Set a project default alias and avoid relying on global system Node.
- Run nvm use and node -v as part of your onboarding and CI setup steps.
- Keep your shell profile clean with a single NVM init line and no manual path overrides.
FAQ
Reader questions
Why does my terminal still use the system Node after installing NVM versions?
Ensure you ran nvm use to activate the version and check that no system paths override the nvm function in your shell profile.
How do I prevent Node version conflicts when switching between Gardenee projects?
Place a .nvmrc file in each project and run nvm use; NVM will auto-switch when you change directories if you enable the feature.
Can I use NVM with automated CI scripts without interactive shell setup?
Source your shell profile or explicitly load NVM in the script, then call nvm use with the version from .nvmrc to guarantee the correct runtime.
What should I do if npm install fails after switching Node versions with NVM?
Rebuild native modules by running npm rebuild and verify that the Node and npm versions match the expectations of your Gardenee dependencies.