Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker container gives No binary for Chrome browser on your platform

I'm running Angular unit tests in a Docker container and getting this error:

21 01 2021 01:51:10.057:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
21 01 2021 01:51:10.063:INFO [launcher]: Starting browser Chrome
21 01 2021 01:51:10.097:ERROR [launcher]: No binary for Chrome browser on your platform.
  Please, set "CHROME_BIN" env variable.

To run the tests I am simply running .. ng test .. using the image node:14 from Docker Hub

Is there an almost identical (preferably official) image that I can use that also has Chrome all ready to go on it?

like image 839
danday74 Avatar asked Jan 27 '26 00:01

danday74


1 Answers

I had to run this on build server:

wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list
apt-get update
apt-get install -y google-chrome-stable xvfb
npm i -g @angular/cli

All the instructions except the last install Chrome. The last installs Angular and is not needed if you are not using Angular.

NOTE: I had to have Chrome installed because ng test uses Chrome - however, I've since switched to Jest which I believe can run unit tests without Chrome installed - although I haven't checked this.

like image 142
danday74 Avatar answered Jan 28 '26 17:01

danday74



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!