Cypress: Circle-ci binary installation process fails

Created on 14 Aug 2018  路  14Comments  路  Source: cypress-io/cypress

Current behavior:

The binaries fail to install the correct version on circle-ci as part of the post-install script.

Here's some background:

  • We use yarn workspaces to maintain our monorepo
  • A while ago, we had realized that running yarn install just simply failed to install the binaries during post-install. For that reason, we opted in for a hacky solution where we ran npm install cypress 3.0.3 after yarn install was completed. 3.0.3 is the cypress version in our package json.
  • That solution seemed to work well for a while, but every now and then, it fails and we find ourselves dealing with this recurring binary issue.
  • For some reason, cypress thinks that we need to use binary version 3.0.1, even though both the package.json, and the npm install versions are 3.0.3.

Not sure if this is helpful, but here's the error log from cypress:

> [email protected] postinstall /home/circleci/repo/services/web-client/node_modules/cypress
> node index.js --exec install

Installing Cypress (version: 3.0.3)

[18:09:56]  Downloading Cypress     [started]
[18:09:58]  Downloading Cypress     [completed]
[18:09:58]  Unzipping Cypress       [started]
[18:11:07]  Unzipping Cypress       [completed]
[18:11:07]  Finishing Installation  [started]
[18:11:07]  Finishing Installation  [completed]

You can now open Cypress by running: node_modules/.bin/cypress open

https://on.cypress.io/installing-cypress

npm notice created a lockfile as package-lock.json. You should commit this file.
+ [email protected]
added 197 packages, removed 23 packages and updated 1 package in 88.063s
yarn install v1.7.0
[1/4] Resolving packages...
(node:1763) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "workspace-aggregator-be9cc594-b6d7-4a9e-9fcd-eb84d8b56218 > @matterapp/matter-errors > [email protected]" has unmet peer dependency "eslint-plugin-jsx-a11y@^6.0.2".
warning "workspace-aggregator-be9cc594-b6d7-4a9e-9fcd-eb84d8b56218 > graphql-server > [email protected]" has incorrect peer dependency "graphql@^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0".
warning "workspace-aggregator-be9cc594-b6d7-4a9e-9fcd-eb84d8b56218 > graphql-server > [email protected]" has incorrect peer dependency "graphql@^0.10.3".
warning "workspace-aggregator-be9cc594-b6d7-4a9e-9fcd-eb84d8b56218 > graphql-server > [email protected]" has unmet peer dependency "babel-core@^6.0.0 || ^7.0.0-alpha || ^7.0.0-beta || ^7.0.0".
warning "workspace-aggregator-be9cc594-b6d7-4a9e-9fcd-eb84d8b56218 > lambdas > [email protected]" has unmet peer dependency "bluebird@>=3.4.4".
[4/4] Building fresh packages...
warning Ignored scripts due to flag.
success Saved lockfile.
Done in 38.07s.
yarn run v1.7.0
$ ./e2e.sh
$ NODE_ENV=test yarn watch
$ node ./src/scripts/wait-for-servers.js
$ ./node_modules/.bin/react-scripts start
$ DEBUG=gql:* ./node_modules/.bin/nodemon -e js,pug --exec yarn start:dev
[nodemon] 1.12.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `yarn start:dev`
$ ./node_modules/.bin/babel-node ./src/index.js
Starting the development server...

Successfully connected to the servers
$ ./node_modules/.bin/cypress run --record --key 2c0f6e31-f162-49be-86c6-23ef3623524e
The cypress npm package is installed, but the Cypress binary is missing.

We expected the binary to be installed here: /home/circleci/.cache/Cypress/3.1.0/Cypress/Cypress

Reasons it may be missing:

- You're caching 'node_modules' but are not caching this path: /home/circleci/.cache/Cypress
- You ran 'npm install' at an earlier build step but did not persist: /home/circleci/.cache/Cypress

Properly caching the binary will fix this error and avoid downloading and unzipping Cypress.

Alternatively, you can run 'cypress install' to download the binary again.

https://on.cypress.io/not-installed-ci-error
----------

Platform: linux (Debian - 8.10)
Cypress Version: 3.1.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Exited with code 1

There are 2 useful tips in here:

  • You're caching 'node_modules' but are not caching this path: /home/circleci/.cache/Cypress
  • You ran 'npm install' at an earlier build step but did not persist: /home/circleci/.cache/Cypress

We currently have caching disabled, so I'm not sure how to proceed here.

Desired behavior:

The desired behavior is for cypress to understand that we want to use v3.0.3, and not v3.0.1.

Steps to reproduce:

  • Create a monorepo with yarn workspaces
  • Use circle-ci for ci
  • Install and run cypress on the ci container

Versions

  • Cypress: 3.0.3
  • Circle-ci 2.0
  • yarn 1.7.0
duplicate

Most helpful comment

It's likely this is a bug in the cli, I will look into this, thanks for all the detailed info

All 14 comments

@paulfalgout just out of curiosity, do you also see installation issues whenever Cypress releases a new version?

We'll I've only had this problem the once, but I've only updated from a v3.x to another v3.x once as well, which I think is part of the issue. Do you have cypress installed in multiple workspaces? I had attributed my issue to that.

We actually only depend on cypress in one package, so that would at least mean that our issue is not attributable to multiple versions

hi cypress team! would it be possible to get some updates here? have you guys experimented with installing cypres binaries from within yarn workspaces?

It's likely this is a bug in the cli, I will look into this, thanks for all the detailed info

Hey @Bkucera @jennifer-shehane any luck w this issue?

@mechanical-turk where do you see Cypress 3.0.1 mentioned? I see version 3.1.0 in the log you posted

Platform: linux (Debian - 8.10)
Cypress Version: 3.1.0
error Command failed with exit code 1.

Is it possible your package.json has a different version of cypress installed? You shouldn't have to run npm install cypress seperately from npm/yarn install. You'll also need to make sure you rimraff node_modules before a yarn install

Also, globally installing cypress isn't recommended, because it can cause errors like this with mismatched versions

This also happens when having multiple cypress deps of the same version See https://github.com/cypress-io/cypress/issues/4595

@mechanical-turk Any update on your side?

@jennifer-shehane we could not find a solution so we ended up temporarily disabling cypress on our CI layer. It's kinda funny but nowadays we run our tests locally and not on CI anymore. I'm sure that if you folks keep up your good work, it'll be resolved in no time!

We'll I've only had this problem the once, but I've only updated from a v3.x to another v3.x once as well, which I think is part of the issue. Do you have cypress installed in multiple workspaces? I had attributed my issue to that.

@paulfalgout can you please explain how did you solve that? I am switching from one version to another and getting the same issue.

Closing as duplicate of #4595 as I don't see any evidence that this is happening outside of yarn workspaces.

If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix.

Our issue came from switching from npm to yarn in circleci. We got this error:
The cypress npm package is installed, but the Cypress binary is missing. We expected the binary to be installed here: /home/circleci/.cache/Cypress/3.5.0/Cypress/Cypress

The solution was to persist the cypress/* folder:

- persist_to_workspace:
    root: .
    paths:
      - node_modules/*
      - cypress/*
Was this page helpful?
0 / 5 - 0 ratings