cypress run -b chrome fails if you attempt to change the baseUrl

Created on 24 Sep 2018  路  16Comments  路  Source: cypress-io/cypress

Current behavior:

cypress run fails if you attempt to change the baseUrl from the command line while using the --browser chrome option

Running each of these commands individually work as expected with no errors
> cypress run --browser chrome
> cypress run --config baseUrl=http://localhost:3000

but strangely, combining them both causes the process to immediately exit with an error.
The failure is almost immediate, there is no output from cypress and no tests are run.

> cypress run --browser chrome --config baseUrl=http://localhost:3000

Error: [email protected] cypress:cl: `cypress run --browser chrome --config baseUrl=http://localhost:3000`
Exit status 4294967295
    at EventEmitter.<anonymous> (C:\ProgramData\nvm\v8.11.3\node_modules\npm\node_modules\npm-lifecycle\index.js:285:16)
    at emitTwo (events.js:126:13)
    at EventEmitter.emit (events.js:214:7)
    at ChildProcess.<anonymous> (C:\ProgramData\nvm\v8.11.3\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

It seemed strange, so I tried combining --browser chrome with other options.
This ran as expected with no errors:
> cypress run --browser chrome --config chromeWebSecurity=false

But if you try to set the baseUrl with --env, the same error occurs!

> cypress run --browser chrome --env baseUrl=http://localhost:3000

My current workaround is to set the CYPRESS_BASE_URL environment variable manually prior to calling cypress run.

Desired behavior:

> cypress run --browser chrome --config baseUrl=http://localhost:3000
should not fail

Steps to reproduce:

set baseUrl in cypress.json to localhost:4200
then run
> cypress run --browser chrome --config baseUrl=http://localhost:3000

Versions

Cypress 3.1.0
Windows 10 using git bash
Node 8.11.3
Chrome Version 69.0.3497.100

windows cli

Most helpful comment

I'm experiencing the exact same behavior as @MadLittleMods
npx cypress open
With no parameters, using config file settings, it works fine, however if I add --config baseUrl=X
it fails. The debug output is identical.
Ends with
cypress:cli child event fired { event: 'exit', code: 4294967295, signal: null } +35ms
cypress:cli child event fired { event: 'close', code: 4294967295, signal: null } +2ms

This happened as soon as I upgraded to 3.5

I am running windows 10.
[email protected]
[email protected]

All 16 comments

I also saw this and started using CYPRESS_baseUrl env variable instead - this actually ended up simplifying my workflow so I forgot about this issue as it no longer affects me.

I'm not able to reproduce this. How are you using the `npm-lifecycle module? Since I see that's where this error is being thrown from.

I have the same issue on windows 10:
node: v8.9.4
npm: 5.6.0
cypress: 3.1.4

Unfortunately we'll have to close this issue if no reproducible example is provided. Can anyone provide a way to reproduce this?

I'm experiencing the same problem.

Cypress: 3.1.5
Typescript: 3.3.3
npm: 6.4.1
node: 10.12.0

On windows 10.

I also have noticed this issue.

Windows 10
Cypress 3.2.0
NPM 6.5.0
Node 11.13.0

I turned on debugging to provide an extract in case it helps. As you can see, the process just fails without any error message.

C:\Development\web-client (master)
位 cypress run --browser chrome --config baseUrl=http://localhost:8080
  cypress:cli cli starts with arguments ["C:\\Program Files\\nodejs\\node.exe","C:\\Program Files\\nodejs\\node_modules\\cypress\\bin\\cypress","run","--browser","chrome","--config","baseUrl=http://localhost:8080"] +0ms
  cypress:cli NODE_OPTIONS is not set +0ms
  cypress:cli program parsing arguments +5ms
  cypress:cli running Cypress +1ms
  cypress:cli parsed cli options { config: 'baseUrl=http://localhost:8080', browser: 'chrome' } +60ms
  cypress:cli verifying Cypress app +0ms
  cypress:cli checking environment variables +1ms
  cypress:cli checking if executable exists C:\Users\User\AppData\Local\Cypress\Cache\3.2.0\Cypress\Cypress.exe +4ms
  cypress:cli Binary is executable? : true +3ms
  cypress:cli binaryDir is  C:\Users\User\AppData\Local\Cypress\Cache\3.2.0\Cypress +1ms
  cypress:cli Reading binary package.json from: C:\Users\User\AppData\Local\Cypress\Cache\3.2.0\Cypress\resources\app\package.json +0ms
  cypress:cli Found binary version 3.2.0 installed in: C:\Users\User\AppData\Local\Cypress\Cache\3.2.0\Cypress +4ms
  cypress:cli { verified: true } +5ms
  cypress:cli is Verified ? true +3ms
  cypress:cli processing run options +0ms
  cypress:cli --key is not set, looking up environment variable CYPRESS_RECORD_KEY +0ms
  cypress:cli run to spawn.start args ["--run-project","C:\\Development\\web-client","--config","baseUrl=http://localhost:8080","--browser","chrome"] +1ms
  cypress:cli needs XVFB? false +0ms
  cypress:cli spawning Cypress with executable: C:\Users\User\AppData\Local\Cypress\Cache\3.2.0\Cypress\Cypress.exe +2ms
  cypress:cli spawn forcing env overrides { FORCE_COLOR: '1', DEBUG_COLORS: '1', MOCHA_COLORS: '1', FORCE_STDIN_TTY: '1', FORCE_STDOUT_TTY: '1', FORCE_STDERR_TTY: '1' } +1ms
  cypress:cli spawn args [ '--run-project', 'C:\\Development\\web-client', '--config', 'baseUrl=http://localhost:8080', '--browser', 'chrome', '--cwd', 'C:\\Development\\web-client' ] { dev: undefined, detached: false, stdio: 'pipe' } +3ms

C:\Development\web-client (master)
位

Are you all using Windows 10? May be only happening in there.

@flotwig Any ideas on these cli flags and how they should be passed in through Windows?

Hmm, this definitely looks like a bug, strange that the args appear to be passed in correctly, then they're passed to the server correctly, but it still doesn't work...

I wonder if these will act any differently:

## swapping the order of arguments
cypress run --config baseUrl=http://localhost:3000 --browser chrome 
cypress run --browser chrome --config "baseUrl=http://localhost:3000"

I can confirm this bug on Win10. Neither switching the quotes around or the arguments as @flotwig suggested works. Setting the baseurl via an environment variable does however.

I only started seeing the problem with Cypress 3.5.0

For reference, our Cypress tests are here, https://gitlab.com/gitlab-org/gitter/webapp/blob/086ff67a30a838091fec30beedd923a920797cca/test/e2e/e2e-test.js


Related issues:

Cypress 3.4.1 鉁旓笍

$ npm run cypress -- run --env baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api

... tests run as normal ...

Using cypress open, test runner appears and tests can run,

$ npm run cypress -- open --env baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api


npm WARN npm npm does not support Node.js v10.15.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/

> [email protected] cypress C:\Users\MLM\Documents\GitLab\webapp
> cypress "open" "--env" "baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"

Cypress 3.5.0 :x:

$ npm run cypress -- run --env baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api

npm WARN npm npm does not support Node.js v10.15.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/

> [email protected] cypress C:\Users\MLM\Documents\GitLab\webapp
> cypress "run" "--env" "baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"

npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! [email protected] cypress: `cypress "run" "--env" "baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"`
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the [email protected] cypress script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\MLM\AppData\Roaming\npm-cache\_logs\2019-10-28T10_55_01_062Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! [email protected] test-e2e-run: `npm run cypress -- run --env baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api`
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the [email protected] test-e2e-run script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\MLM\AppData\Roaming\npm-cache\_logs\2019-10-28T10_55_01_161Z-debug.log

Using cypress open, nothing happens (no test runner appears) and it just exits right away,

$ npm run cypress -- open --env baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api

npm WARN npm npm does not support Node.js v10.15.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/

> [email protected] cypress C:\Users\MLM\Documents\GitLab\webapp
> cypress "open" "--env" "baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"

@MadLittleMods Can you try again with debug logs enabled, and share those logs here? It will show some more information which we can use to get to the root of the issue.

  • On Linux/macOS: DEBUG=cypress:* cypress ...
  • On Windows: npx cross-env DEBUG=cypress:* cypress ...

@flotwig For reference, here is the MR where we are updating to Cypress 3.5.0, https://gitlab.com/gitlab-org/gitter/webapp/merge_requests/1631. I just did a workaround using the env field in cypress.json instead of passing variables via --env

Cypress 3.5.0 and --env

Here is the output with set DEBUG=cypress:* and no workaround

$ npm run cypress -- run --env baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api

npm WARN npm npm does not support Node.js v10.15.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/

> [email protected] cypress C:\Users\MLM\Documents\GitLab\webapp
> cypress "run" "--env" "baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"

  cypress:cli cli starts with arguments ["C:\\Program Files\\nodejs\\node.exe","C:\\Users\\MLM\\Documents\\GitLab\\webapp\\node_modules\\cypress\\bin\\cypress","run","--env","baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"] +0ms
  cypress:cli NODE_OPTIONS is not set +0ms
  cypress:cli program parsing arguments +11ms
  cypress:cli running Cypress +3ms
  cypress:cli parsed cli options { env:
   'baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api' } +81ms
  cypress:cli verifying Cypress app +0ms
  cypress:cli checking environment variables +2ms
  cypress:cli checking if executable exists C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress\Cypress.exe +3ms
  cypress:cli Binary is executable? : true +3ms
  cypress:cli binaryDir is  C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress +1ms
  cypress:cli Reading binary package.json from: C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress\resources\app\package.json +0ms
  cypress:cli Found binary version 3.5.0 installed in: C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress +6ms
  cypress:cli { verified: true } +8ms
  cypress:cli is Verified ? true +5ms
  cypress:cli processing run options +0ms
  cypress:cli --key is not set, looking up environment variable CYPRESS_RECORD_KEY +1ms
  cypress:cli run to spawn.start args ["--run-project","C:\\Users\\MLM\\Documents\\GitLab\\webapp","--env","baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"] +1ms
  cypress:cli needs to start own Xvfb? false +0ms
  cypress:cli spawning, should retry on display problem? false +1ms
  cypress:cli spawning Cypress with executable: C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress\Cypress.exe +32ms
  cypress:cli spawn args [ '--run-project', 'C:\\Users\\MLM\\Documents\\GitLab\\webapp', '--env', 'baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api', '--cwd', 'C:\\Users\\MLM\\Documents\\GitLab\\webapp' ] { detached: false, stdio: 'pipe', windowsHide: false } +3ms
  cypress:cli piping process STDIN into child STDIN +140ms
  cypress:cli piping child STDOUT to process STDOUT +2ms
  cypress:cli piping child STDERR to process STDERR +2ms
  cypress:cli child event fired { event: 'exit', code: 4294967295, signal: null } +26ms
  cypress:cli child event fired { event: 'close', code: 4294967295, signal: null } +2ms
npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! [email protected] cypress: `cypress "run" "--env" "baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"`
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the [email protected] cypress script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\MLM\AppData\Roaming\npm-cache\_logs\2019-10-28T21_19_31_425Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! [email protected] test-e2e-run: `npm run cypress -- run --env baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api`
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the [email protected] test-e2e-run script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\MLM\AppData\Roaming\npm-cache\_logs\2019-10-28T21_19_31_516Z-debug.log
$ npm run cypress -- open --env baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api

npm WARN npm npm does not support Node.js v10.15.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/

> [email protected] cypress C:\Users\MLM\Documents\GitLab\webapp
> cypress "open" "--env" "baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"

  cypress:cli cli starts with arguments ["C:\\Program Files\\nodejs\\node.exe","C:\\Users\\MLM\\Documents\\GitLab\\webapp\\node_modules\\cypress\\bin\\cypress","open","--env","baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"] +0ms
  cypress:cli NODE_OPTIONS is not set +0ms
  cypress:cli program parsing arguments +5ms
  cypress:cli opening Cypress +3ms
  cypress:cli parsed cli options { env:
   'baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api' } +79ms
  cypress:cli opening from options {"env":"baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api","project":"C:\\Users\\MLM\\Documents\\GitLab\\webapp"} +0ms
  cypress:cli command line arguments ["--env","baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api","--project","C:\\Users\\MLM\\Documents\\GitLab\\webapp"] +2ms
  cypress:cli verifying Cypress app +0ms
  cypress:cli checking environment variables +2ms
  cypress:cli checking if executable exists C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress\Cypress.exe +5ms
  cypress:cli Binary is executable? : true +7ms
  cypress:cli binaryDir is  C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress +2ms
  cypress:cli Reading binary package.json from: C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress\resources\app\package.json +0ms
  cypress:cli Found binary version 3.5.0 installed in: C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress +10ms
  cypress:cli { verified: true } +12ms
  cypress:cli is Verified ? true +9ms
  cypress:cli needs to start own Xvfb? false +0ms
  cypress:cli spawning, should retry on display problem? false +5ms
  cypress:cli spawning Cypress with executable: C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress\Cypress.exe +39ms
  cypress:cli spawn args [ '--env', 'baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api', '--project', 'C:\\Users\\MLM\\Documents\\GitLab\\webapp', '--cwd', 'C:\\Users\\MLM\\Documents\\GitLab\\webapp' ] { detached: false, stdio: 'inherit', windowsHide: false } +2ms
  cypress:cli child event fired { event: 'exit', code: 4294967295, signal: null } +184ms
  cypress:cli child event fired { event: 'close', code: 4294967295, signal: null } +4ms

I'm experiencing the exact same behavior as @MadLittleMods
npx cypress open
With no parameters, using config file settings, it works fine, however if I add --config baseUrl=X
it fails. The debug output is identical.
Ends with
cypress:cli child event fired { event: 'exit', code: 4294967295, signal: null } +35ms
cypress:cli child event fired { event: 'close', code: 4294967295, signal: null } +2ms

This happened as soon as I upgraded to 3.5

I am running windows 10.
[email protected]
[email protected]

@bahmutov Is this issue fixed by/related to #5853?

Oh yeah - this is the same issue and should be fixed by https://github.com/cypress-io/cypress/pull/5853

Closing this issue as a duplicate of #5466

Released in 3.8.0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

egucciar picture egucciar  路  3Comments

tahayk picture tahayk  路  3Comments

jennifer-shehane picture jennifer-shehane  路  3Comments

carloscheddar picture carloscheddar  路  3Comments

brian-mann picture brian-mann  路  3Comments