Automatically Switch Node Version Whenever You Change Directories Using NVM and Zsh

Voon Ming Hann
1 min readMay 31, 2023

To prevent outdated Node version from causing issues with your package-json.lock or yarn.lock, one solution is to include an “engines” property in your package.json file. You can specify the minimum required versions like so:

"engines": {
"npm": ">=9.5.0",
"node": ">=18.15.0"
}

This will prevent anyone who uses a lower Node version to run npm install.

On top of this prevention, you can set up Zsh automation to switch to the correct…

--

--