I have a Dev dependency in my package.json file on protractor
"protractor": "~2.1",
However protractor uses an older version of
"selenium-webdriver": "2.45.1",
I need to update this to use 2.46.1. How can I override this in my package.json file? Currently to test it out I went to /node_modules/protractor/package.json and changed it there which made. I looked at npm-shrinkwrap but that seems to lock all the packages and I just want to override a single package
For your problem you can user something called as npm shrinkwrap.
I think that is the way they explained it. Yes you are correct it locks down the dependency but, by doing so you also want same thing you want some specific dependency for your need.
Take a look at this question How do I override nested NPM dependency versions?
NPM 8 introduced "overrides" which allows you to override specific transitive dependencies of your direct dependency. For your usecase, you would declare something like below.
{
"overrides": {
"protractor": {
"selenium-webdriver": "2.46.1"
}
}
}
More details @ https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides
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