Cli: [BUG] lifecycle scripts not run in workspace packages after install

Created on 15 Oct 2020  路  2Comments  路  Source: npm/cli

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

Bug Needs Triage Release 7.x

All 2 comments

Hi @peterjuras, thanks for the report! We do have a patch lined up already and should land hopefully in the next patch release, just want to make sure it gets some more testing prior to landing it 馃槉 I'll keep you posted 馃憤

Thanks for the quick response. I'm looking forward to using npm 7 in more of our repositories.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

millerick picture millerick  路  3Comments

theADAMJR picture theADAMJR  路  3Comments

darcyclarke picture darcyclarke  路  4Comments

DullReferenceException picture DullReferenceException  路  4Comments

goldingdamien picture goldingdamien  路  4Comments