https://cypress.io logo
Windows Git bash throws error
# i-need-help
a
My co-worker is facing an error while trying to run cypress through vscode -> git bash (Im guessing vscode uses git bash for the git tab). I have set up the project using husky to run cypress tests before commiting (pre commit hook). Everything when manually running every single command in powershell. But when using the git tab in vscode it fails with the following error. Havent used Windows for some years, and i am not really sure whats going on. There are none
start-cypress
file next to
index.jsc
and couldnt find it anywhere in the server package. Havent been able to find any related issues.
Copy code
bash
$ C:\Users\{user}\Documents\code\vue-webapp\node_modules\.bin\cypress run --e2e
Error: Cannot find module './start-cypress'
Require stack:
- C:\Users\{user}\AppData\Local\Cypress\Cache\12.9.0\Cypress\resources\app\packages\server\index.jsc
    at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
    at Module._load (node:internal/modules/cjs/loader:785:27)
    at c._load (node:electron/js2c/asar_bundle:5:13339)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at i (C:\Users\{user}\AppData\Local\Cypress\Cache\12.9.0\Cypress\resources\app\index.js:1:2232)
    at startCypress (evalmachine.<anonymous>:1:799866)
    at evalmachine.<anonymous>:1:800126
    at v (C:\Users\{user}\AppData\Local\Cypress\Cache\12.9.0\Cypress\resources\app\index.js:1:2573)
    at Object.<anonymous> (C:\Users\{user}\AppData\Local\Cypress\Cache\12.9.0\Cypress\resources\app\index.js:1:2764)
    at Module._compile (node:internal/modules/cjs/loader:1120:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\{user}\\AppData\\Local\\Cypress\\Cache\\12.9.0\\Cypress\\resources\\app\\packages\\server\\index.jsc'
  ]
}
m
Hi @ambitious-animal-14300 There are quite a few "gotchas" on Windows with Husky. Which version of Husky are you using?
a
It seems to have been resolved twice. yarn.lock
Copy code
husky@^4.3.0:
  version "4.3.8"
husky@^8.0.3:
  version "8.0.3"
package.json
Copy code
json
{
  "devDependencies": {
    "husky": "^8.0.3",
  }
}
m
Thanks for confirmation that you are working with "modern" Husky! I'm guessing that your issue is due to path problems. You might find some answers to your VSCode issue in https://github.com/typicode/husky/issues. Due to related issues, when I'm working on Windows I have Husky disabled with environment variable
HUSKY=0
. There are too many issues with paths and different
bash
versions, which gets worse if you have WSL enabled. I work with
git
at the CLI level and GitHub Desktop as a UI. I don't use VSCode to commit. If necessary I run the equivalent of the Husky pre-commit commands by hand. For serious stuff I move to Ubuntu 🙂 !
a
Thanks. Ill take a look at husky issues. Otherwise he will have to learn git cli. Thank you for your time 🙂
2 Views