-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
Bugthing that needs fixingthing that needs fixingPriority 1high priority issuehigh priority issueRelease 7.xwork is associated with a specific npm 7 releasework is associated with a specific npm 7 release
Description
Current Behavior:
A package dependency installed as a symlink will get its lifecycle scripts (such as postinstall
) run twice when running the npm rebuild
subcommand of npm
.
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
- Add this as a preinstall script for the
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:
% npm rebuild --foreground-scripts
> [email protected] preinstall
> echo 'You will see this twice!'
You will see this twice!
> [email protected] preinstall
> echo 'You will see this twice!'
You will see this twice!
rebuilt dependencies successfully
Environment:
- OS: macOS Catalina 10.15.7
- Node: v15.12.0
- npm: 7.6.3
Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixingPriority 1high priority issuehigh priority issueRelease 7.xwork is associated with a specific npm 7 releasework is associated with a specific npm 7 release