Unable to start Cypress with ELECTRON_RUN_AS_NODE=1
See original GitHub issueCurrent behavior
If you set env with ELECTRON_RUN_AS_NODE=1
, with MacOS, you are not able to start the Cypress with
ELECTRON_RUN_AS_NODE=1 npx cypress run
You’ll get error:
Error: Cannot find module '/Users/<username>/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/MacOS/Contents/Resources/app/index.js'
Checking the code, it seems that here is where it went wrong: https://github.com/cypress-io/cypress/blob/b615e8ac30b681b4dc8485afe9814ff453da1fbf/cli/lib/exec/spawn.js#L175
The correct path, at least for Mac, should be:
path.join(state.getBinaryPkgPath(path.join(executable, '..', '..', '..')), '..', 'index.js');
Desired behavior
Cypress should start correctly
Test code to reproduce
Try run with
ELECTRON_RUN_AS_NODE=1 npx cypress run
Cypress Version
10.6.0
Node version
16.0
Operating System
macOS
Debug Logs
No response
Other
Cypress 10.7.0 (latest) also has this problem
Issue Analytics
- State:
- Created a year ago
- Comments:15 (10 by maintainers)
Top Results From Across the Web
Cypress failed to start on Windows - Stack Overflow
→ Cypress Version: 1.4.1 Cypress failed to start. This is usually caused by a missing library or dependency. The error below should indicate...
Read more >Troubleshooting | Cypress Documentation
If the smoke test fails to execute, check if a shared library is missing (a common problem on Linux machines without all of...
Read more >cypress - npm
Cypress comes packaged as an npm module, which is all you need to get started testing. After installing you'll be able to: Open...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I got the same problem on MacOS. It’s different on Linux:
Seems similar to #17412.
Looking at the docs…
To figure out the priority on fixing this bug - do you have a specific use case in mind where you need to launch with
ELECTRON_RUN_AS_NODE
?It says missing dependency, but this might be a red herring.