Skip to content

Preserve global node_modules during reinstall #17

@thisdavej

Description

@thisdavej

Hi Steven, I experienced an issue with my globally installed npm packages getting wiped. Here are the steps to reproduce on a Pi Zero:

  1. Install Node using an install script such as install-node-v.last.sh
  2. Install npm packages globally such as pm2``: npm install -g pm2`
  3. Install a different version of Node using a script such as install-node-v.lts.sh

After these steps, the pm2 command cannot be invoked and is no longer available as well as any other NPM packages that I installed globally. I see in the install scripts that /opt/nodejs gets wiped every time the install script runs and thus the contents of /opt/nodejs/lib/node_modules containing pm2 gets wiped too.

Can you update the install scripts to preserve the contents of /opt/nodejs/lib/node_modules (with the possible exception of the npm directory which will be regenerated) before doing the installation?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions