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

Doesn't run on Windows "Error: spawn cypress ENOENT" #57

Closed
mattmazzola opened this issue Mar 10, 2019 · 4 comments
Closed

Doesn't run on Windows "Error: spawn cypress ENOENT" #57

mattmazzola opened this issue Mar 10, 2019 · 4 comments
Assignees

Comments

@mattmazzola
Copy link

Executing the command npx percy exec -- cypress run --spec "cypress/integration/*" fails on when running locally on Windows but runs successfully on CircleCI linux VM so that's why I'm guessing it's OS dependent.

Output:

E:\Repos\cra-typescript-cypress [master ≡ +0 ~3 -0 !]> npx percy exec -- cypress run --spec "cypress/integration/*"
npx: installed 1 in 1.954s
The "path" argument must be of type string. Received type undefined
E:\Repos\cra-typescript-cypress\node_modules\@percy\agent\bin\run
[percy] created build #5: https://percy.io/conversationlearner/test/builds/1541219
[percy] percy has started.
events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: spawn cypress ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:217:19)
    at onErrorNT (internal/child_process.js:394:16)
    at process._tickCallback (internal/process/next_tick.js:174:19)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:223:12)
    at onErrorNT (internal/child_process.js:394:16)
    at process._tickCallback (internal/process/next_tick.js:174:19)

Versions:

"cypress": "3.1.4",
"@percy/cypress": "1.0.2"

Windows 10 Pro 10.0.17763 Build 17763

@Robdel12 Robdel12 self-assigned this Mar 10, 2019
@Robdel12
Copy link
Contributor

Hey Matt! Thanks for opening an issue, I'm going to give this a whirl on my Windows machine today to see if I can uncover what's going on here.

@Robdel12
Copy link
Contributor

Alright, what is going on here is really subtle. Could you give this a try and see if it works for you?

npx percy exec -- cypress.cmd run --spec "cypress/integration/*"

That worked for me locally and it's what we have to do in our node scripts with example apps to support windows: https://github.com/percy/example-percy-cypress/pull/23/files#diff-5768af5deda587912dcade757b171d20R8

@mattmazzola
Copy link
Author

mattmazzola commented Mar 26, 2019

Sorry it took so long to follow up.

I confirmed that using cypress.cmd instead of cypress worked / does not produce the error.
Although can you explain why/how this change works?

I thought the cypress command was using the commands exposed by the cypress package and am not sure how adding .cmd would have an affect. I'm assume something to do with the way --exec parameter is written?

@Robdel12
Copy link
Contributor

Going to close this one up. We released a new version of both this SDK & the underlying SDK (@percy/agent) that removes the need to specify .cmd for Windows: percy/percy-agent#175

What's happening is nodes spawn ignores windows PATHEXT which is kinda like $PATH & that means spawn only works on Windows for .exe files. There's a little more information in the PR linked above.

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