question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VSCode git pre-push hook triggers: bad option: --no-sandbox

See original GitHub issue

Current behavior:

When pre-push hook trigger via VSCode build-in git extension, we have the following error:

2020-06-11T14:33:53.786Z cypress:cli:cli cli starts with arguments ["/Users/xx/.nvm/versions/node/v10.16.0/bin/node","/Users/xx/repos/xxx/node_modules/xxxx/node_modules/.bin/cypress","run","--headless","--browser","chrome"]
2020-06-11T14:33:53.787Z cypress:cli NODE_OPTIONS is not set
2020-06-11T14:33:53.788Z cypress:cli:cli program parsing arguments
2020-06-11T14:33:53.793Z cypress:cli:cli running Cypress with args [ Command { commands: [], options: [ [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option] ], _execs: Set {}, _allowUnknownOption: false, _args: [], _name: 'run', _optionValues: {}, _storeOptionsAsProperties: true, _passCommandToAction: true, _actionResults: [], _helpFlags: '-h, --help', _helpDescription: 'output usage information', _helpShortFlag: '-h', _helpLongFlag: '--help', _noHelp: false, _exitCallback: undefined, _executableFile: undefined, parent: Command { commands: [Array], options: [Array], _execs: Set {}, _allowUnknownOption: false, _args: [], _name: 'cypress', _optionValues: {}, _storeOptionsAsProperties: true, _passCommandToAction: true, _actionResults: [], _helpFlags: '-h, --help', _helpDescription: 'output usage information', _helpShortFlag: '-h', _helpLongFlag: '--help', _usage: '<command> [options]', _events: [Object], _eventsCount: 9, rawArgs: [Array], args: [] }, _usage: '[options]', _description: 'Runs Cypress tests from the CLI without the GUI', _argsDescription: undefined, _events: [Object: null prototype] { 'option:browser': [Function], 'option:ci-build-id': [Function], 'option:config': [Function], 'option:config-file': [Function], 'option:env': [Function], 'option:group': [Function], 'option:key': [Function], 'option:headed': [Function], 'option:headless': [Function], 'option:no-exit': [Function], 'option:parallel': [Function], 'option:port': [Function], 'option:project': [Function], 'option:record': [Function], 'option:reporter': [Function], 'option:reporter-options': [Function], 'option:spec': [Function], 'option:tag': [Function], 'option:dev': [Function] }, _eventsCount: 19, exit: true, headless: true, browser: 'chrome' } ]
2020-06-11T14:33:53.961Z cypress:cli:cli variable-length opts parsed { args: [ '/Users/xx/.nvm/versions/node/v10.16.0/bin/node', '/Users/xx/repos/xxx/node_modules/xxxx/node_modules/.bin/cypress', 'run', '--headless', '--browser', 'chrome' ], opts: Command { commands: [], options: [ [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option] ], _execs: Set {}, _allowUnknownOption: false, _args: [], _name: 'run', _optionValues: {}, _storeOptionsAsProperties: true, _passCommandToAction: true, _actionResults: [], _helpFlags: '-h, --help', _helpDescription: 'output usage information', _helpShortFlag: '-h', _helpLongFlag: '--help', _noHelp: false, _exitCallback: undefined, _executableFile: undefined, parent: Command { commands: [Array], options: [Array], _execs: Set {}, _allowUnknownOption: false, _args: [], _name: 'cypress', _optionValues: {}, _storeOptionsAsProperties: true, _passCommandToAction: true, _actionResults: [], _helpFlags: '-h, --help', _helpDescription: 'output usage information', _helpShortFlag: '-h', _helpLongFlag: '--help', _usage: '<command> [options]', _events: [Object], _eventsCount: 9, rawArgs: [Array], args: [] }, _usage: '[options]', _description: 'Runs Cypress tests from the CLI without the GUI', _argsDescription: undefined, _events: [Object: null prototype] { 'option:browser': [Function], 'option:ci-build-id': [Function], 'option:config': [Function], 'option:config-file': [Function], 'option:env': [Function], 'option:group': [Function], 'option:key': [Function], 'option:headed': [Function], 'option:headless': [Function], 'option:no-exit': [Function], 'option:parallel': [Function], 'option:port': [Function], 'option:project': [Function], 'option:record': [Function], 'option:reporter': [Function], 'option:reporter-options': [Function], 'option:spec': [Function], 'option:tag': [Function], 'option:dev': [Function] }, _eventsCount: 19, exit: true, headless: true, browser: 'chrome' } }
2020-06-11T14:33:53.962Z cypress:cli parsed cli options { browser: 'chrome', headless: true }
2020-06-11T14:33:53.963Z cypress:cli verifying Cypress app
2020-06-11T14:33:53.964Z cypress:cli checking environment variables
2020-06-11T14:33:53.968Z cypress:cli checking if executable exists /Users/xx/Library/Caches/Cypress/4.7.0/Cypress.app/Contents/MacOS/Cypress
2020-06-11T14:33:53.970Z cypress:cli Binary is executable? : true
2020-06-11T14:33:53.970Z cypress:cli binaryDir is  /Users/xx/Library/Caches/Cypress/4.7.0/Cypress.app
2020-06-11T14:33:53.971Z cypress:cli Reading binary package.json from: /Users/xx/Library/Caches/Cypress/4.7.0/Cypress.app/Contents/Resources/app/package.json
2020-06-11T14:33:53.974Z cypress:cli Found binary version 4.7.0 installed in: /Users/xx/Library/Caches/Cypress/4.7.0/Cypress.app
2020-06-11T14:33:53.975Z cypress:cli { verified: true }
2020-06-11T14:33:53.975Z cypress:cli is Verified ? true
2020-06-11T14:33:53.976Z cypress:cli:run processing run options { browser: 'chrome', headless: true, key: null, spec: null, reporter: null, reporterOptions: null, project: '/Users/xx/repos/xxx' }
2020-06-11T14:33:53.976Z cypress:cli:run --key is not set, looking up environment variable CYPRESS_RECORD_KEY
2020-06-11T14:33:53.976Z cypress:cli:run run to spawn.start args ["--run-project","/Users/xx/repos/xxx","--browser","chrome","--headed",false]
2020-06-11T14:33:53.976Z cypress:cli needs to start own Xvfb? false
2020-06-11T14:33:53.977Z cypress:cli spawning, should retry on display problem? false
2020-06-11T14:33:53.983Z cypress:cli spawning Cypress with executable: /Users/xx/Library/Caches/Cypress/4.7.0/Cypress.app/Contents/MacOS/Cypress
2020-06-11T14:33:53.984Z cypress:cli spawn args [ '--no-sandbox', '--', '--run-project', '/Users/xx/repos/xxx', '--browser', 'chrome', '--headed', false, '--cwd', '/Users/xx/repos/xxx' ] { detached: false, stdio: [ 'inherit', 'inherit', 'pipe' ] }
2020-06-11T14:33:53.988Z cypress:cli piping child STDERR to process STDERR
/Users/xx/Library/Caches/Cypress/4.7.0/Cypress.app/Contents/MacOS/Cypress: bad option: --no-sandbox
2020-06-11T14:33:57.094Z cypress:cli child event fired { event: 'exit', code: 9, signal: null }
2020-06-11T14:33:57.094Z cypress:cli child event fired { event: 'close', code: 9, signal: null }
npm ERR! code ELIFECYCLE

(I marked some folder name to be 'x’s intentionally)

Desired behavior:

It should run Cypress test as it was trigger by git cli.

Test code to reproduce

Versions

Cypress: 4.7.0 MacOs: 10.14.5 Node Version: 10.16.0

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
silviuaavramcommented, Dec 26, 2020

I also have this issue in downshift. We have a cypress test run in the pre-commit hook. It happens when I commit from VSCode.

[test:cypress] /Users/savram/Library/Caches/Cypress/6.2.0/Cypress.app/Contents/MacOS/Cypress: bad option: --no-sandbox
[test:cypress] 
[test:cypress] INFO: Gracefully shutting down. Please wait...
[test:cypress] Error: Command failed with exit code 9: npm run cy:run
[test:cypress]     at makeError (/Users/savram/Documents/git-repos/downshift/node_modules/start-server-and-test/node_modules/execa/lib/error.js:56:11)
[test:cypress]     at handlePromise (/Users/savram/Documents/git-repos/downshift/node_modules/start-server-and-test/node_modules/execa/index.js:114:26)
[test:cypress]     at processTicksAndRejections (internal/process/task_queues.js:97:5) {
[test:cypress]   command: 'npm run cy:run',
[test:cypress]   exitCode: 9,
[test:cypress]   signal: undefined,
[test:cypress]   signalDescription: undefined,
[test:cypress]   stdout: undefined,
[test:cypress]   stderr: undefined,
[test:cypress]   failed: true,
[test:cypress]   timedOut: false,
[test:cypress]   isCanceled: false,
[test:cypress]   killed: false
[test:cypress] }
[test:cypress] npm run test:cypress --silent exited with code 1

Let me know if I can provide more info.

1reaction
JoMiguelSantoscommented, Feb 3, 2021

I have the same exact issue with the same error while using precommit hook. Any potential fix or reason why this might be happening?

Edit: this only happens while using the Git extension GUI that comes with VSCode to commit like someone mentioned. If I use the command line it works fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The hook `black` requires pre-commit version 2.9.2 but ...
The following error pops up whenever I use the commit button / press ctrl + enter in visual studio code. VS Code -...
Read more >
githooks Documentation - Git
An exception are hooks triggered during a push (pre-receive, update, post-receive, post-update, push-to-checkout) which are always executed in $GIT_DIR.
Read more >
Introduction to collision - Unity - Manual
A collider configured as a Trigger (using the Is Trigger property) does not behave as a solid object and will simply allow other...
Read more >
Changelog — Python 3.11.1 documentation
Fix incorrect check which allowed more than one varargs in clinic.py. Fix miscalculation of noptargs in generated code. Do not generate noptargs when...
Read more >
Nixpkgs 22.11 manual - NixOS
Because overlays that are set in NixOS configuration do not affect non-NixOS operations such as nix-env , the overlays.nix option provides a convenient...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found