Skip to content
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

Cypress installation error #1

Closed
ehmicky opened this issue May 21, 2020 · 5 comments
Closed

Cypress installation error #1

ehmicky opened this issue May 21, 2020 · 5 comments

Comments

@ehmicky
Copy link

ehmicky commented May 21, 2020

It seems like some builds are having issues running cypress install:

┌───────────────────────────────────────────────────────┐
│ 1. onPreBuild command from netlify-plugin-visual-diff │
└───────────────────────────────────────────────────────┘

no Cypress cache found — installing it now

┌────────────────────────────────────────────────────┐
│ Plugin "netlify-plugin-visual-diff" internal error │
└────────────────────────────────────────────────────┘

Error message
Error: Command failed with ENOENT: cypress install
spawn cypress ENOENT

cypress is present in package.json, then it should be available in node_modules/.bin, so I am not sure what might happen. Something that would debug this problem: if the command throws, print error.stderr and error.stdout (note this requires stdio option to be pipe or not defined).

@jlengstorf
Copy link
Contributor

I followed the lead of netlify-plugin-cypress to store the Cypress binary between builds:
https://github.com/jlengstorf/netlify-plugin-visual-diff/blob/8ca55e2b06c8b35203747d585e080f9c9de37cf8/index.js#L94-L102

I can see that this might be causing issues, though (cypress-io/netlify-plugin-cypress#50)

I have no idea why this wouldn't be available, though. this kind of points back to my suspicion that the cache utils are flaky sometimes (see also https://github.com/netlify/build/issues/1225) — I think they sometimes confirm a save, then miss on restoration

I also have zero idea how a fresh install would be missing. that kind of feels upstream? I'm happy to help debug, but I have no idea where to even start (for example, I don't know what the "stdio option" refers to — which link in this chain needs that option set?)

@ehmicky
Copy link
Author

ehmicky commented May 28, 2020

@ehmicky
Copy link
Author

ehmicky commented Jun 2, 2020

It looks like the utils.cache.restore() and utils.cache.save() operations might not be needed here.

When cypress install runs, it is added to ~/.cache/Cypress. ~/.cache is saved and restored to the build cache by default by Netlify buildbot. cypress install detects this automatically and becomes a quick noop instead when Cypress has already been installed/cached.

Actually, if users are already using cypress (including through netlify-plugin-cypress), this will be cached in ~/.cache/Cypress, so having it cached in /opt/buildhome/.cache/Cypress would create duplicate cache (of 580MB).

Also, ../../buildhome/.cache/Cypress would not work when using a base directory, since some additional .. might be needed to reach /opt/buildhome/.

On a different topic: cypress install itself might not be needed. Unless I'm mistaken, this operation is done on postinstall by Cypress. Since cypress is a dependency of netlify-plugin-visual-diff, I think removing that call altogether should work.

I think it might be interesting to see if the plugin still work after removing the two following things?

  • utils.cache.restore() and utils.cache.save()
  • utils.run('cypress', ['install'])

@jlengstorf
Copy link
Contributor

this was fixed in #2 — please let me know if you see anything in the logs for this one!

@ehmicky
Copy link
Author

ehmicky commented Jul 3, 2020

Thanks @jlengstorf!

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

No branches or pull requests

2 participants