Reputation: 18043
I'm getting this error in CI when updating to Cypress 3.0
, saying that Cypress is not installed, but I am running npm install
before my cypress run
command. The error:
No version of Cypress is installed in:
/home/ubuntu/.cache/Cypress/3.0.1/Cypress
Please reinstall Cypress by running: cypress install
----------
Why is Cypress not finding the Cypress executable?
Here's my circle.yml
:
build:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- v1-npm-deps
- run: npm install
- save_cache:
key: v1-npm-deps-{{ checksum "package.json" }}
paths:
- node_modules
- ~/.cache
- ~/.npm
- run: npm test
- run: npm run build
- persist_to_workspace:
root: /tmp/workspace
paths:
- .circleci/deploy.sh
- .circleci/e2e-test.sh
- package.json
- cypress.json
- node_modules/
- build/*
- cypress/*
Upvotes: 2
Views: 6888
Reputation: 18043
This a small problem with caching node_modules
- the post-install script that installs the Cypress binary won't be run since node_modules/cypress
exists.
To fix this you can flush the cache of the CI build and everything should be solved.
This is why I recommend using npm ci
, since node_modules
will get wiped every time the command is run
Also:
- in Circle CI 2.0, caching works differently than in 1.0
or TravisCI
because the cache is immutable. You can only create another cache, never destroy and rewrite one. So, you should do caching like this:
- restore_cache:
keys:
- v1-deps-{ .Branch }-{ checksum "package.json" }
- v1-deps-{ .Branch }
- v1-deps
- run:
- npm ci
- save_cache:
key: v1-deps-{ .Branch }-{ checksum "package.json" }
paths:
- ~/.cache
- ~/.npm
Upvotes: 1