karma-chrome-launcher: ChromeHeadless can't run as root with --no-sandbox anymore
After updating to Chrome 62 and Chromedriver 2.33, I get the following error when running karma tests with ChromeHeadless:
| 25 10 2017 08:47:40.197:ERROR [launcher]: Cannot start ChromeHeadless
| [1025/084740.006078:ERROR:zygote_host_impl_linux.cc(88)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
This is in Docker running Ubuntu 16
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 44
- Comments: 25
Commits related to this issue
- Correction pour utiliser Chrome sans sandbox Solution trouvée ici : https://github.com/karma-runner/karma-chrome-launcher/issues/158 — committed to gsalaun1/tech-radar-jhipster by gsalaun1 7 years ago
- Add support for HeadlessChrome in karma Motivation for this change: As a tester, I want to execute npm unit tests in a headless chrome environment. Notes on implementation: * Running headless ... — committed to openstack-archive/openstack-health by twm2016 6 years ago
- build: Set --no-sandbox in Chrome for Travis The Travis CI build for wikimedia/oojs has been failing since January 2018 due to an incompatibility between Travis' Docker configuration, and Chrome's sa... — committed to wikimedia/oojs-core by Krinkle 6 years ago
- Revise karma configuration for Travis CI See https://github.com/karma-runner/karma-chrome-launcher/issues/158 — committed to thierrymarianne/experimenting-with-compilation-principles by thierrymarianne 6 years ago
- fix: 8.8.7 単体テストユーティリティの導入。Vue Test Utilsによる効率化。この状態で動かないのを修正する エラーメッセージを検索して、対処していった。 プラグイン不足 - javascript - Vue-test-utils can't find `Set()`: ReferenceError: Can't find variable: Set - Stack Ove... — committed to oki2a24/kanban-app by oki2a24 6 years ago
- fix chrome headless issue when running as root https://github.com/karma-runner/karma-chrome-launcher/issues/158 — committed to art-in/microcosm by art-in 5 years ago
- fix chrome headless issue when running as root https://github.com/karma-runner/karma-chrome-launcher/issues/158 — committed to art-in/microcosm by art-in 5 years ago
- fix: use chromeheadless not sandbox reference: https://github.com/karma-runner/karma-chrome-launcher/issues/158 — committed to AllanZhengYP/aws-sdk-js-v3 by AllanZhengYP 4 years ago
- fix: use chromeheadless not sandbox reference: https://github.com/karma-runner/karma-chrome-launcher/issues/158 — committed to AllanZhengYP/aws-sdk-js-v3 by AllanZhengYP 4 years ago
- fix: use chromeheadless not sandbox reference: https://github.com/karma-runner/karma-chrome-launcher/issues/158 — committed to AllanZhengYP/aws-sdk-js-v3 by AllanZhengYP 4 years ago
- fix: use chromeheadless not sandbox reference: https://github.com/karma-runner/karma-chrome-launcher/issues/158 — committed to AllanZhengYP/aws-sdk-js-v3 by AllanZhengYP 4 years ago
- fix: use chromeheadless not sandbox reference: https://github.com/karma-runner/karma-chrome-launcher/issues/158 — committed to AllanZhengYP/aws-sdk-js-v3 by AllanZhengYP 4 years ago
- fix: use chromeheadless not sandbox reference: https://github.com/karma-runner/karma-chrome-launcher/issues/158 — committed to AllanZhengYP/aws-sdk-js-v3 by AllanZhengYP 4 years ago
- run ChromeHeadless with --no-sandbox See https://github.com/karma-runner/karma-chrome-launcher/issues/158 — committed to cardwiki/cardwiki by Gittenburg 4 years ago
Workaround:
If you’re running Puppeteer directly from Node code, you can provide this flag as follows:
const browser = await puppeteer.launch({headless: true, args:['--no-sandbox']});Sorry for the rookie question: and where should I put this text?
browsers: [‘ChromeHeadlessNoSandbox’], customLaunchers: { ChromeHeadlessNoSandbox: { base: ‘ChromeHeadless’, flags: [‘–no-sandbox’] } },
Where is this karma config?
I keep getting smth like this in bitbucket pipeline.
When specifying the browser as
ChromeHeadlessthis is automatically added, yes.Don’t forget to add
--headless ChromeHeadlessNoSandboxto yourtestcommand. For me, that meant changingng test ${library} --browsers ChromeHeadless --watch=${watch}tong test ${library} --browsers ChromeHeadlessNoSandbox --watch=${watch}It’s probably obvious to you, but it took me a minute to figure that out. I hope that helps.
i solved after see this videos https://youtu.be/tc379GTTgys
100% problem has been fixed 😃 …
@DragonRus By default, most projects have Karma configuration stored in a file named “karma.conf.js.” However, that is just the default; the configuration file could be named anything and passed to Karma like this:
karma start some-karma-config.js.If your project doesn’t have a configuration file, you can generate it by running
karma initfrom a command line. See the Karma documentation.THANKS BRO FOR THIS VIDEO MY PROBLEM SOLVED; <<<print(“thanks for this”)
^^ I had something like that in Jenkins. Turned out I had to set the
--browsersflag in the command as it was still defaulting to plain headless Chrome without the--no-sandboxflag. Here’s one example of what I used:yarn test --single-run --no-progress --browsers Chrome_without_securityWhere
Chrome_without_securitywas set up as this:Puppeteer is there to handle any missing Chrome package, of course.
boboldehampsink, sorry, but where should this workaround be written? Is it about docker?
Worked for me too. Thanks guys!
Keywords: CodeBuild, Karma, Chrome
@Zicrou or any can give some advice about How it works for you?
i will show mine config for compare
karma.config
protractor.config
gitlab-ci.yml
definition for npm run test-ci is:
and that is the error give me gitlab jobs in console
I have this version of puppeteer --> “puppeteer”: “^1.19.0”,
i am missing something?
thx
Thanks! @yuri-wisestamp
I was not aware of the ability to define custom launchers. I would consider it very helpful if this was added to the README.
For me, my karma.config.js was missing this:
about this solution i have this setup
karma.config
in package.json apply npm run test-ci
gitlab-ci results
In karma config