Skip to content

Conversation

@MaxBlack-dev
Copy link
Contributor

Description

This PR documents that prepare scripts run concurrently across workspace packages, addressing user confusion about execution order.

Changes

  • Add note that prepare scripts run concurrently in workspaces
  • Document --foreground-scripts workaround for sequential execution
  • Provide guidance for users with interdependent workspace packages (e.g., TypeScript builds)

Fixes

Closes #4100

Context

Users with workspace setups that have interdependent packages (such as TypeScript projects where one package depends on another's build output) were confused when prepare scripts ran concurrently, causing build failures. The documentation implied sequential execution but didn't explicitly state that lifecycle scripts run concurrently.

Per @lukekarrys's comment in #4100, the action item was to document this behavior. The workaround is to use --foreground-scripts (which can be set in .npmrc with foreground-scripts=true) to force sequential execution, though this comes with performance trade-offs.

@MaxBlack-dev MaxBlack-dev requested a review from a team as a code owner December 3, 2025 21:12
@owlstronaut owlstronaut merged commit aa1dd7e into npm:latest Dec 3, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] npm i in workspace runs prepare script concurrently

2 participants