-
Notifications
You must be signed in to change notification settings - Fork 463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for reinstall packages from other versions #620
Comments
Duplicate of #139 ? |
No, these are two distinct features. |
@ljharb looks like the issue I linked is all about “reinstalling packages from”. Is there a feature of default packages in nvm too? |
The one you linked's title and OP suggest it's about "installing packages by default with a newly installed node version", which is a feature of nvm. This one is about |
thanks @ljharb, I read nvm's docs and now I understand. :) |
|
I'd love to see this supported too, but in the mean time, this little shell command makes it a little easier to get a list of your installed global modules npm list -g --json | jq -r '.dependencies | keys | join(" ")' This assumed you have jq installed. It'll format all the installed modules in a single line that you can copy and paste (or redirect to your clipboard by adding Run this in the old version, of course. If you're adventurous, you could try something to install them automatically, but you'd need to redirect the output from an older node version to the new one. Somehow. |
@jschuur that will include |
Are you suggesting if I run Is this an fnm specific issue or a general possibility? |
I made a little shell script to help me with this. Just add it to your bashrc/zshrc. Hope this helps some people. fnm-reinstall-packages-from () { npm install -g $(fnm exec --using=$1 npm list -g | grep "├──\|└──" | awk '{gsub(/@[0-9.]+/, "", $2); print $2}' | tr '\n' ' ' | sed 's/ $//') } Example Usage:
|
@jschuur yes, you can, because newer versions of npm don't necessarily work on older node versions, and once a broken one is installed, you're screwed. |
Here's a Nushell version: npm list -g -json
| from json
| get dependencies
| items {|key, value| { name: $key, version: $value.version } }
| format "{name}@{version}"
| each { |r| npm install $r } |
Please add support for
reinstall-packages-from
flag likenvm
🙏🏻The text was updated successfully, but these errors were encountered: