Skip to content

[Feature]: Install packages from previous version #1244

Closed

Description

@Eccenux

Description of the new feature / enhancement

Would be nice to have a command that makes upgrades easier.

Something like this:

nvm install lts
nvm use lts
nvm reinstall-global --from=20.16

I think it should ask if you want the same packages or latest versions.

Or perhaps even better support this flow:

npm list -g --depth=0 --json > g_mods.json
nvm install-use lts
nvm reinstall-global --from=g_mods.json

And reinstall-global should still ask if you want the same packages or latest versions.

Scenario when this would be used?

Update node to latest lts. E.g. from v20.16 to v20.19.

Supporting information

Linux version seem to support something similar:

nvm install NEW_VERSION --reinstall-packages-from=OLD_VERSION

Not sure if I like it as I think options are less discoverable. Having more then 600 up votes suggest it works as needed:
https://stackoverflow.com/questions/34810526/how-to-properly-upgrade-node-using-nvm

Activity

  1. coreybutler commented on Mar 16, 2025

    @coreybutler
    Collaborator

    Runtime (and the parent app, Author) will have something along these lines.

    One of the big differentiators between any existing version manager and Author is that Author runs as a daemon/background service. This provides far more options to make better developer experiences.

    More to your point, it will be possible to configure native event handlers (and create custom ones). For example, when a new version of Node is installed, it can trigger a user-configured handler to install/upgrade global npm modules in that version (or not... user choice). We intend to ship native handlers for common things like global module reinstallation.

    As you may have seen in the 1.2.x releases, we shipped a subset of our notification service. It loosely illustrates our overarching goal to provide update events when a new version is released. Using this approach, it would be possible to auto-update an LTS release line whenever a new update is released, which in turn could auto-install/update global node modules or do any number of other things.

    The bottom line is we're aware of the desire (we have it too), but I've felt strongly that there is a better approach. There are inherent security risks in blindly installing npm updates, compatibility issues, and all kinds of other "gotchas". By breaking the process down, we can mitigate many security concerns, give users greater control, and still provide a familiar experience.

    I really appreciate you submitting this, because it validates the direction we're already going. Thank you for taking the time to post this.

    I'm going to convert this to a discussion and am happy to continue the conversation there.

  2. locked and limited conversation to collaborators on Mar 16, 2025
  3. converted this issue into a discussion #1245 on Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions