DEV Community

Shubham
Shubham

Posted on

How you enforce team members to use same node version

Basically I use nvm to maintain different node version on my system. I want to know how can I warn or prevent user to install libraries in project with different node version because it may lead to bugs in production environment.

Top comments (2)

Collapse
 
recursivefaults profile image
Ryan Latta

You can control most of this through the package.json file of your projects. You can fix the versions of the libraries and I believe you can also specify a node version as well.

Pinning library versions at least to minor release is pretty standard. As for locking a node version that is a little less common, but possible.

You can also control this by writing a script that ensures a production version of your software uses all the correct versions, so there is less hope that a person that is too busy does it all correctly by hand.

Collapse
 
imunshi profile image
Munshi • Edited

You need .nvmrc. You can use node -v > .nvmrc to maintain same node version.

You can see more in here