I would like to reinstall npm from scratch. I wish to reinstall the packages already installed globally in npm, after the reinstall. What would be the safest (and non-manual) way to export and import the globally installed modules?
Implementation note: my old npm also required sudo for global installations, so I'm not really looking to reuse the same directory, rather, to have the new npm install the same package list as the old one had.
I use this on Windows with PowerShell:
[string]::join(" ", ((npm ls -g --depth=0) | select -skip 1 | select -skiplast 1 | % { $_.remove(0,4) }))
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