Skip to content

[BUG] on npm install npm does not run the prepublish scripts in workspace packages. #3065

@michalczaplinski

Description

@michalczaplinski

Current Behavior:

Repo has workspace packages like:

├── package.json
└── packages
    └── a
        └── package.json

Workspaces are defined like:

// root package.json
"workspaces": [
  "packages/*"
]

Package a has a prepublish script:

"scripts": {
  "prepublish": "touch a-prepublish"
},

then when running npm install at root, the prepublish script does not run.

Expected Behavior:

The prepublish script should run on npm install in all of the packages that are specified as workspace packages.

Steps To Reproduce:

https://github.com/michalczaplinski/npm-bug-repro

run npm install at root of the repo.

You can verify that the file a-prepublish file was not created in the package a.

Environment:

> npm -v
7.9.0
> node -v
v15.11.0

Metadata

Metadata

Assignees

No one assigned

    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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions