Managing Node.js with Volta

Search for a command to run...

I haven't used nvm yet because I want to work with the latest version of node. But sure I wanna try out this new thing: Volta.
Does this mean that we can install a specific version of node for a specific project we wanna build? 🤔
Thanks for bringing this to us Corey!
Hey max,
I work on multiple projects that all require a different version of node. Both NVM and Volta allow me to easily install and switch between the different versions.
I do recommend trying each one out yourself.
Corey O'Donnell Yes but, I personally haven't encountered any issue with any version of node.
If possible, can you please write a blog-post on what is the need for using different versions of node
Usman Sabuwala when you get hired, you might get to work on multiple existing projects, some older than others and you can't just simply upgrade your version because some things may break due to compatibility issues or something.
That's why you need tools to control the version you are in, so that you can work on different projects, that have been started in different dates but still need maintenance/features.
Probably there's more reasons, I'm just starting out and this is my main one.
Have you ever wondered how to set a hotkey to focus an input field in your React application? Follow along to learn how. We'll even handle showing different hotkeys based on whether the user is on a Mac or Windows system. Implementation const SearchI...

As a software engineer, choosing and understanding your text editor is important part of your work, as it impacts your productivity and workflow efficiency. It's like choosing the perfect tool for any trade - you need to know what tool to use and how...

Design systems are essential tools for software engineers as they provide a structured framework for maintaining consistency and coherence in product design. By offering clear guidelines and standards, design systems streamline the development proces...

Let's Build our own real-time page view tracker using Next.js as the frontend framework and a Postgres database hosted by Supabase. One of the best ways to understand how your blog posts are performing is by tracking page views. You can begin to unde...

One of the best ways to drive traffic to your website is to have strong Search Engine Optimization (SEO). You can provide search engines with all the URLs for your website using a Sitemap. This allows for easier indexing and more efficient crawling b...

I recently wrote a blog post about how I use NVM to manage my node version. Someone commented on the post saying I should look into Volta
Volta is a command line tool used to manage your Node.js. It is built using Rust and is shipped as a static binary that can be ran on Windows and all *nix shells. The goal is to make sure every developer working on the project seamlessly has the same tools and versions installed.
The installation is simple.
# install Volta
curl https://get.volta.sh | bash
The script installs the binary in ~/.volta and adds ~/.volta/bin to your systems path inside of your ~/.bash_profile, ~/.profile, and ~/.bashrc.
export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"
Now you can start using Volta to manage Node.js.
You can easily install node using
# Install node
volta install node
# or you can install a specific version
volta install node@12
Now node should be available to use whenever you open your terminal.
If you want to set Volta to always load a specific version of node for your active package you can use pin.
volta pin node@12.18.3
This command will store your pinned version in your package.json.
"volta": {
"node": "12.18.3"
}
Every time you navigate to your project, Volta will automatically set your active node version to whatever is pinned.
You can even install and pin global packages like yarn using Volta to make sure everyone on your team is using the same version for their global packages.
volta install yarn
volta pin yarn
NVM is just a node version manager. It only handles installing different versions of node. You can also set a default version of node to load whenever you open your terminal. Volta handles node versions and can set a default version to load also.
When opening a terminal, NVM usually takes about 0.5 to 2 seconds to source in bash if you have a default node version set. Volta does not seem to add any load time.
You can pin node version for your projects using both tools. NVM uses a .nvmrc file and Volta adds a key to your package.json. Volta can also pin versions for global NPM packages used for the project.
NVM does not automatically switch your active node version to your pinned version. You have to run nvm use or install another package call AVN. AVN usually takes 2 to 5 seconds to switch node versions. Volta does it automatically and usually takes less than a second.
Even though I have been using NVM for almost 4 years, I think Volta takes the crown. I plan to use Volta for managing all my Node.js needs from now on. The speed and simplicity of the tool just makes it the better choice. NVM, I am thankful you for all the headaches you have saved me in the past but I think it is time to move on.