Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MikeMcC399 opened this issue Apr 11, 2025 · 2 comments
Open

Comments

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Apr 11, 2025

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

@MikeMcC399
Copy link
Contributor Author

MikeMcC399 commented Apr 14, 2025

[email protected], released Apr 14, 2025 has resolved several configuration issues, so this Cypress documentation enhancement can now be moved forward.

@MikeMcC399
Copy link
Contributor Author

  • PR extend pnpm config instructions #6149 is submitted to add the side effects cache instructions to the installation configuration
  • A separate PR will follow to add related troubleshooting steps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant