Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deep "npm update"?

Running npm update updates items listed in package.json; however, the dependencies of those items are still outdated.

The obvious workaround is to run npm update once more. Sometimes I need to run it 3+ times to have clean npm outdated. Is there a flag in npm update to perform a deep update?

Another extreme workaround is to reinstall

rm -rf node_modules
npm install

Update

It has bee 5 years, and I am still running the code above with the addition of rm package-lock.json when I really need to shake it. Seeing "red lines" in npm out output after npm up is no longer a problem.

like image 986
kornieff Avatar asked Aug 26 '26 13:08

kornieff


1 Answers

As an ugly workaround I have this function defined in my ~/.bash_profile

function up {
    npm remove --save "$1";
    npm install --save "$1";
}

So whenever I want to update a dependency I just run up express or up yourFavoritePackage

like image 189
Renato Gama Avatar answered Aug 29 '26 02:08

Renato Gama



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!