Inside a Node.js project, it's not clear to me what is the correct workflow to ugpgrade a package to a major release.
Let's suppose I'm istalling stylelint: npm install --save stylelint
by default puts inside my package.json the string "stylelint": "^8.4.1" which means that if I want to update it with npm update
, I will get only minor and patch releases (8.4.2 is ok, 8.5.0 in ok, 9.0.0 is not).
If I check with npm outdated
and it comes out that I could update to 9.0.0, npm update
wouldn't work because of the restriction depicted above.
So, if I want to upgrade, what am I supposed to do?
Have I to manually modify my package.json to stylelint version ^9.0.0, delete node_modules directory and re-run npm install
?
Or maybe I have just to remove the ^
character to let npm update
do its job?
What is the common/best practice to adopt?
Thanks
So, if I want to upgrade, what am I supposed to do?
In order to update major releases you can use the npm-check-updates
.
See this great answer.