Skip to content

[BUG](arborist) Lifecycle Scripts of file: dependencies do not run #4277

@nVitius

Description

@nVitius

What / Why

Arborist skips the lifecycle scripts of packages installed from a local path

When

  • Running npm install (npm v7.2.0/arborist v2.7.1)

Where

  • n/a

How

Current Behavior

Arborist runs the lifecycle scripts for a package in the _build step of reify.
I spent some time stepping through the debugger to see where the issue was happening and found this:
https://github.com/npm/arborist/blob/c5e1618a0059b37ee878b73553d7dc47bf3fa976/lib/arborist/reify.js#L973
I'm not sure what target.fsTop is here or how it is calculated, but it seems that any packages installed with a local path, are skipped from the rebuild because of this condition.

Removing the condition allows the scripts to run correctly.

I will gladly work on this if someone could point me in the right direction.

Steps to Reproduce

  • install a package with a local path (e.g. "dep-postinstall-test": "file:../dep-postinstall-test")
  • ensure the package (dep-postinstall-test) has a postinstall script
  • run npm i --foreground-scripts (to verify the output of the postinstall)

Expected Behavior

  • postinstall scripts of all dependencies should run

Who

  • n/a

References

  • n/a

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingPriority 2secondary priority issuews:arboristRelated to the arborist workspace

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions