cypress: Bad Option: --no-sandbox thrown when ELECTRON_RUN_AS_NODE=1

Current behavior

I am working to integrate cypress testing into our CI. I was getting Xvfb errors, so I started using the ELECTRON_RUN_AS_NODE=1 env variable.

However, when that variable is fixed, it fixes the Xvfb errors but causes some bad option errors.

build	23-Sep-2021 15:20:16	> cypress run --config-file ./e2e/cypressAngular.headless.json --headless -b chrome
build	23-Sep-2021 15:20:16	
build	23-Sep-2021 15:20:16	It looks like this is your first time using Cypress: 8.3.0
build	23-Sep-2021 15:20:16	
build	23-Sep-2021 15:20:16	[STARTED] Task without title.
error	23-Sep-2021 15:20:17	[FAILED] Cypress failed to start.
build	23-Sep-2021 15:20:17	Cypress failed to start.
build	23-Sep-2021 15:20:17	
build	23-Sep-2021 15:20:17	This may be due to a missing library or dependency. https://on.cypress.io/required-dependencies
build	23-Sep-2021 15:20:17	
build	23-Sep-2021 15:20:17	Please refer to the error below for more details.
build	23-Sep-2021 15:20:17	
build	23-Sep-2021 15:20:17	----------
build	23-Sep-2021 15:20:17	
build	23-Sep-2021 15:20:17	/usr/local/bamboo/.cache/Cypress/8.3.0/Cypress/Cypress: bad option: --no-sandbox
build	23-Sep-2021 15:20:17	/usr/local/bamboo/.cache/Cypress/8.3.0/Cypress/Cypress: bad option: --smoke-test
build	23-Sep-2021 15:20:17	/usr/local/bamboo/.cache/Cypress/8.3.0/Cypress/Cypress: bad option: --ping=68
build	23-Sep-2021 15:20:17	
build	23-Sep-2021 15:20:17	----------
build	23-Sep-2021 15:20:17	
build	23-Sep-2021 15:20:17	Platform: linux (CentOS - 7.9.2009)
build	23-Sep-2021 15:20:17	Cypress Version: 8.3.0

Desired behavior

Run the tests

Test code to reproduce

My configuration is:

{
  "fileServerFolder": ".",
  "fixturesFolder": "./e2e/fixtures",
  "integrationFolder": "./e2e/integration",
  "modifyObstructiveCode": false,
  "pluginsFile": "./e2e/plugins/index.ts",
  "supportFile": "./e2e/support/index.ts",
  "video": false,
  "videosFolder": "./e2e/videos",
  "screenshotsFolder": "./e2e/screenshots",
  "chromeWebSecurity": false,
  "baseUrl": "http://localhost:4200",
  "viewportHeight": 960,
  "viewportWidth": 1536,
  "env": {
    "tsConfig": "./e2e/tsconfig.json"
  },
  "ignoreTestFiles": [
    "**/__snapshots__/*",
    "**/__image_snapshots__/*"
  ]
}

I am also setting the env var ELECTRON_RUN_AS_NODE=1 externally by using export ELECTRON_RUN_AS_NODE=1

Cypress Version

v8.3.0 (Also tested in 8.4.1)

Other

Not sure if the issue is related or not, but I can’t test this issue locally because when I set the ELECTRON_RUN_AS_NODE=1 env variable I get the error Error: Cannot find module '/Users/reidkersey/Library/Caches/Cypress/8.3.0/Cypress.app/Contents/MacOS/Contents/Resources/app/index.js'

I have also tried setting "ELECTRON_RUN_AS_NODE": "1" in the env section of the config file, and that didn’t work, and gave me the Xvfb error.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 11
  • Comments: 15 (2 by maintainers)

Most upvoted comments

used commands: npm insall export ELECTRON_RUN_AS_NODE=1 npm run test

now iam getting this error…Anyone had any solution for this error??

It looks like this is your first time using Cypress: 12.7.0

[STARTED] Task without title. [FAILED] Cypress failed to start. [FAILED] [FAILED] This may be due to a missing library or dependency. https://on.cypress.io/required-dependencies [FAILED] [FAILED] Please refer to the error below for more details. [FAILED] [FAILED] ---------- [FAILED] [FAILED] /apps/jenkins/.cache/Cypress/12.7.0/Cypress/Cypress: bad option: --no-sandbox [FAILED] /apps/jenkins/.cache/Cypress/12.7.0/Cypress/Cypress: bad option: --smoke-test [FAILED] /apps/jenkins/.cache/Cypress/12.7.0/Cypress/Cypress: bad option: --ping=990 [FAILED] [FAILED] ---------- [FAILED]

Same here with cypress 10.3.1

Same thing with Cypress 9.7.0, and I am using Chrome

Just to clarify: It’s more of a workaround, then a real solution. Ideally I think we all would like only one image for the whole build-process, as it saves time and build-budget.

Occurring on 10.11.0

The only thing I found was to use Chrome instead of Electron