What is the purpose of using --save-exact
For example, I use --save-exact
when I manage projects with webpack
.
As you know, when you install a package like npm install --save-dev webpack
for example, our package.json
will add something like:
"devDependencies": {
"webpack": "^5.1.3",
}
What does it mean?
When you delete your node_modules
folder (for example when you put your files on github)and you make a npm install
, maybe a version of any package could be updated and if the version is not a major version (X.0.0), Maybe your application stops working because of update. For example from 5.1.3
maybe the package is going to uptade to 5.1.8
So, the --save-exact
will generate the next package.json
code
"devDependencies": {
"webpack": "5.1.3",
}
Whitout the ^
, the version of the package of webpack in this case will be always the same 5.1.3
.
More reference here about semantic version with NPM:
- About semantic versioning
PDT: Sorry for my poor English.
When using save=true
, npm install
will automatically add the package into package.json without the need of using npm install --save
every time you run the command. save-exact=true
will make sure that no sliding versions (with ~
or ^
) will not be installed.
reference for more information click here
or please go through this https://docs.npmjs.com/cli/install