Node version via package.json

Tobias Zimmermann1 minute reading time

Are you also tired of jumping from one project to another and sometimes you need nodejs 14, sometimes you need nodejs 16, and sometimes you need nodejs 18.

I feel the same way and I know it's just a command with nvm or my personal favourite n.

But what if you go into your project and the right node version is always there?

That was my wish too and I have fulfilled it.

What do you need#

If you install my tool, you can get the right node version directly with npv fix.


npm install -g node-package-version


yarn install -g node-package-version

Then simply add the following part to your .zshrc:

npv fix

Now just press enter or open a new terminal in the project and the script runs and selects the correct node version.