When you run npm install --save somepackage, it usually adds something like this into package.json:
npm install --save somepackage
\"dependencies\": { \"somepackage\": \"^2.1.
You can change the default behaviour by using the --save-exact option.
--save-exact
// npm npm install --save --save-exact react // yarn yarn add --exact react
I created a blog post about this if anyone is looking for this in the future.
https://www.dalejefferson.com/blog/how-to-save-exact-npm-package-versions/