When running cy run
(via npm run test:e2e
) from the terminal it works just fine. The same command added to husky pre-push
results in the following error:
Error: Cannot find module '/Users/me/Library/Caches/Cypress/10.3.1/Cypress.app/Contents/MacOS/Contents/Resources/app/index.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
at Module._load (node:internal/modules/cjs/loader:785:27)
at Function.c._load (node:electron/js2c/asar_bundle:5:13343)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
My .husky/pre-push
file looks like this:
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npm run test
npm run test:e2e
I cannot replicate the error via the terminal. Why is this error only happening with husky and how can I solve it?
- Platform: MacOS
- Node version:
16.14.2
- Cypress version:
10.3.1