I'm using npm
for my React Native project and I'm trying to ignore few packages during npm update
.
For example, I want to keep my React package always on [email protected]
.
But each time I run npm update
it gets updated to [email protected]
.
Any ideas how could I do that?
The Node Package Manager (NPM) provides various commands that let you work with packages. And just as you can install a package from the npm library, you can uninstall it. To uninstall a package, you can use the command provided by npm for the purpose – npm uninstall .
The npm install installs all modules that are listed on package. json file and their dependencies. npm update updates all packages in the node_modules directory and their dependencies.
In your package.json
file use "react": "~16.3.1"
instead of "react": "^16.3.1"
i.e. replace caret (which means equals or higher version) with tilda.
EDIT: @Gabriel Carnerio's point is valid. Tilda is for when minor version changes are ok. Remove it and use "react": "16.3.1"
if you want exact v16.3.1
It behaves depending on the Semantic Versioning of the NPM. Inside dependencies of your package.json file if the react version is specified as "react": "16.3.1",
then your react version will not get updated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With