Skip to content

pnpm side effects cache not compatible with Cypress postinstall script #6147

Open
@MikeMcC399

Description

@MikeMcC399

Issue

pnpm implements a side-effects-cache that uses and caches the results of (pre/post)-install hooks. This does not work if the effects of running the hook are outside the package's module. This is the case for the Cypress postinstall hook which installs the Cypress binary in a separate cache location (see Binary cache). pnpm believes that it is unnecessary to run the Cypress postinstall hook and skips it if the Cypress npm module is already present in the pnpm store cache.

This is not documented on https://docs.cypress.io/ and it is only briefly referred to on https://pnpm.io/settings#sideeffectscache.

This can cause Cypress to report the error:

The cypress npm package is installed, but the Cypress binary is missing.

Suggestion

Add configuration and troubleshooting information for the pnpm side effects cache.

Ideally pnpm would convert to consistently support using pnpm-workspace.yaml, so that Cypress could recommend using:

pnpm config set side-effects-cache false --location project
pnpm --allow-build cypress add --save-dev cypress

There are however multiple related issues (see below) concerning configuration and pnpm 10.x is still evolving in this respect.

I will hold back before attempting to submit any documentation change PRs for this.

Related issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions