Some time has passed since I wrote How I Manage Node & Package Manager Versions in 2024 and few things have changed. So let's see what has changed and what are still goals:
- Things works seamlessly. I switch projects = correct (versions) of tools are automatically used.
- Minimal process to setup new projects is needed.
- Local development environment and CI use the same ways to ensure consistency.
My stack of choice is node and pnpm, but this should work for most commonly used tools.
In the past I've used nvm, n, volta, corepack, nodeenv. While they all have their own strength, I converged to using proto as the tool of choice.
Installation
- If possible, remove all previously versions of
node
orpnpm
to make sure no conflicts occur. - Install
proto
:
> brew install proto
> proto setup
Project setup
Once you're in your my-app
directory, run:
> proto pin node 20.18.0
> proto pin pnpm 9.14.2
It will create my-app/.prototools
file with equivalent content, which can be commited to the repo to ensure that every single machine uses the same tool versions when running my-app
:
node = "20.18.0"
pnpm = "9.14.2"
And this setup will be automatically honoured every time you run node
or pnpm
commands inside your project directory:
> node --version
v20.18.0
> pnpm --version
9.14.2
Top comments (0)