Skip to content

[BUG] lifecycle scripts not run in workspace packages after install #1965

@peterjuras

Description

@peterjuras

Current Behavior:

When running npm install in a workspace root, prepare scripts of individual workspace packages are not run.

Expected Behavior:

The expectation would be that running npm install in a workspace root would be at least equal to running npm install in each individual package (ignoring the additional benefits like hoisting for now).

Steps To Reproduce:

  1. Create a workspace with 2 child packages, or clone this sample repository
  2. Run npm install in the root folder

-> All packages have a prepare script that creates a file in their folder, but only the root prepare script is run. When running npm install in a child package the prepare script is run for this child package.

According to the workspaces RFC all dependencies of nested packages should be installed - which is the case - but also all associated lifecycle scripts should be run, which is not the case yet.

A workaround would be to have a top level prepare script which runs the prepare scripts of nested packages, hopefully soon with a run-script command as detailed in the newer workspaces RFC.

Environment:

OS: independent
Node: v12.18.4
npm: 7.0.0

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 7.xwork is associated with a specific npm 7 release

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions