[BUG] "npm rebuild" runs any symlinked package's lifecycle scripts twice. #2905
Labels
Bug
thing that needs fixing
Priority 1
high priority issue
Release 7.x
work is associated with a specific npm 7 release
Current Behavior:
A package dependency installed as a symlink will get its lifecycle scripts (such as
postinstall
) run twice when running thenpm rebuild
subcommand ofnpm
.Expected Behavior:
Lifecycle scripts should probably only be run once.
Steps To Reproduce:
Set up a minimal/dummy dependency with lifecycle scripts:
mkdir test && cd test && npm init -y
mkdir dependency && cd dependency && npm init -y
dependency
dummy package:"preinstall": "echo 'You will see this twice!'
Add the dummy package with lifecycle scripts as a symlinked dependency:
cd ..
npm install ./dependency
Run
npm rebuild
and verify that the lifecycle script runs twice:npm rebuild --foreground-scripts
Example output:
Environment:
The text was updated successfully, but these errors were encountered: