cypress: Jenkins Error "Error: spawn cmd ENOENT"

Hi, I’m running Cypress on Jenkins in Windows and am experiencing strange behavior. When I first setup Cypress to run in a build, it ran fine, but every time after that, it fails with Error: spawn cmd NOENT

Also, I changed the user that Jenkins runs as and Cypress ran only the first time the build ran, but after the first run, I get the same errors.

Current behavior:

Opening Cypress…

{ Error: spawn cmd ENOENT
    at exports._errnoException (util.js:1024:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:192:19)
    at onErrorNT (internal/child_process.js:374:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs: 
   [ '/c',
     'WMIC path win32_process get Name,Processid,ParentProcessId,Commandline' ] }
Error: spawn cmd ENOENT
    at exports._errnoException (util.js:1024:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:192:19)
    at onErrorNT (internal/child_process.js:374:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

[?25hBuild step 'Execute Windows batch command' marked build as failure
Finished: FAILURE

Desired behavior:

I would like Cypress to run my tests inside of headless mode.

Steps to reproduce: (app code and test code)

I don’t have a public repo to recreate this. If need, I could let somebody take a look at my build server. I’m just executing ./node_modules/.bin/cypress run from a windows batch command inside of Jenkins.

Versions

Windows Server 2016 Cypress 3.2.0 Jenkins latest

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 23 (9 by maintainers)

Most upvoted comments

Not sure if it’s relevant but I’m having the same error when trying to integrate Cypress with Percy on macos:

[percy] percy has started.
events.js:177
      throw er; // Unhandled 'error' event
      ^

Error: spawn cypress ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:9)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:9) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cypress',
  path: 'cypress',
  spawnargs: [
    'run',
    '--browser',
    'chrome',
    '--spec',
    'cypress/integration/Regression/partner_test_flow.js'
  ]
}

here’s the script: “cypress:headless”: “./node_modules/.bin/cypress run” I changed it to: “cypress:headless”: “cypress run”

It gets me to the same spot (error)