puppeteer/puppeteer

raspberry pi Chromium revision is not downloaded

aminjoharinia opened this issue · 85 comments

Hi
i use raspbian stretch and i install puppeteer with npm but it did not download chromium
the os has the latest chromium
chromium-browser is already the newest version (60.0.3112.89-0ubuntu0.14.04.1.1010).
but when i run codes i have get error
(node:4035) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): AssertionError [ERR_ASSERTION]: Chromium revision is not downloaded. Run "npm install" (node:4035) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
i also test npm install as it says but not working
what should i do?

@aminjoharinia Does the npm install puppeteer throw an error for you? Do you have any HTTP proxy installed?

@aslushnikov
No there is no error
I tested with different networks
At the same time , i installed Windows version and it's works fine but in raspberian it does not install browser

I am also running into this issue AssertionError: Chromium revision is not downloaded. Run "npm install". I am running on Mac behind a corporate proxy. My .local-chromium directory is empty.

after many attempts finally chromium downloaded but there is not any folder like .local-chromium in node modules/puppeteer
does it support linux armh ?
could i manually download the file and unzip it?
here is the error
i also download and install all dependces

/home/pi/node_modules/puppeteer/.local-chromium/linux-496140/chrome-linux/chrome: 1: /home/pi/node_modules/puppeteer/.local-chromium/linux-496140/chrome-linux/chrome: �ELF����: not found
/home/pi/node_modules/puppeteer/.local-chromium/linux-496140/chrome-linux/chrome: 2: /home/pi/node_modules/puppeteer/.local-chromium/linux-496140/chrome-linux/chrome: cannot open ��: No such file
/home/pi/node_modules/puppeteer/.local-chromium/linux-496140/chrome-linux/chrome: 3: /home/pi/node_modules/puppeteer/.local-chromium/linux-496140/chrome-linux/chrome: ��: not found
/home/pi/node_modules/puppeteer/.local-chromium/linux-496140/chrome-linux/chrome: 4: /home/pi/node_modules/puppeteer/.local-chromium/linux-496140/chrome-linux/chrome: ��: not found
/home/pi/node_modules/puppeteer/.local-chromium/linux-496140/chrome-linux/chrome: 5: /home/pi/node_modules/puppeteer/.local-chromium/linux-496140/chrome-linux/chrome: ��: not found
/home/pi/node_modules/puppeteer/.local-chromium/linux-496140/chrome-linux/chrome: 6: /home/pi/node_modules/puppeteer/.local-chromium/linux-496140/chrome-linux/chrome: ��: not found
/home/pi/node_modules/puppeteer/.local-chromium/linux-496140/chrome-linux/chrome: 7: /home/pi/node_modules/puppeteer/.local-chromium/linux-496140/chrome-linux/chrome: ��: not found
/home/pi/node_modules/puppeteer/.local-chromium/linux-496140/chrome-linux/chrome: 8: /home/pi/node_modules/puppeteer/.local-chromium/linux-496140/chrome-linux/chrome: Syntax error: ")" unexpected


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

(node:6293) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```

Looks like the downloaded version is x86_64, not arm:

chrome: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not stripped

vs the one in raspbian:

chromium-browser: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, not stripped

Also, it doesn't seem to work with the version in raspbian anyway:

(node:2069) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Timed out after 30000 ms while trying to connect to Chrome! The only Chrome revision guaranteed to work is r497674
(node:2069) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Silur commented

I tried to make a patch for utils/ChromiumDownloader.js but seems like there are no arm64 snapshots and it doesn't worth to only support 32bit arm :/
so my suggestion @saghul is to use browser.launch({executablePath: 'chromium'}) and set the env flag PUPPETEER_SKIP_CHROMIUM_DOWNLOAD

Im going through the exactly same problem.

use browser.launch({executablePath: 'chromium'})

Didn't work. That's what I got.

events.js:182
throw er; // Unhandled 'error' event
^

Error: spawn chromium ENOENT
at _errnoException (util.js:1041:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:192:19)
at onErrorNT (internal/child_process.js:374:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:611:11)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:598:3

I tried with browser.launch({executablePath: 'chromium-browser'}), but I got:

node:14008) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Timed out after 30000 ms while trying to connect to Chrome! The only Chrome revision guaranteed to work is r497674

Silur commented

yes, seems like the working revision (499413) is not present anywhere on google storage api and the version mismatch causes the timeout
google pls upload some arm stuff?

Doesn't seem like there's an easy way to get a recent enough chromium build for arm

krewx commented

First i installed chromium using

sudo apt install chromium-browser

then i used browser.launch({executablePath: '/usr/bin/chromium-browser'}) but now the issue is the following

(node:4107) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed to launch chrome!
bootstrap_helper: /usr/lib/chromium-browser/nacl_helper: Cannot open ELF file! errno=2
[4129:4129:0922/172003.955374:ERROR:nacl_fork_delegate_linux.cc(315)] Bad NaCl helper startup ack (0 bytes)
[4117:4117:0922/172003.958248:ERROR:browser_main_loop.cc(495)] Failed to put Xlib into threaded mode.
[4117:4117:0922/172003.967038:ERROR:browser_main_loop.cc(272)] Gtk: cannot open display

I don't know if this help anyone

Yesterday, I successfully run latest puppeteer on Raspbian. Let me go through all steps that I tried:

  1. just run puppeteer as is - npm install successfully got latest Chromium build for Linux, but on attempt to run it: ELF: not found. Ok, the reason - downloaded version is not arm one.
  2. apt-get install chromium-browser - I tried to use this Chromium by passing executablePath as launch argument but puppeeteer just freezes without any errors or exceptions, I think that chromium-browser version is too old.
  3. I cross compiled latest Chromium for arm using my linux workstation, upload this build to raspberry pi and it finally works.
    I'll upload this build somewhere later this week.
Silur commented

maybe upload it to some CDN and make a PR?

@ak239 Great ! Please upload it faster to check it out
Thanks

Ok. It's temporary solution, I hope that we'll make it more fancy soon.
By following link you can download chromium required for puppeteer in headless mode, download it, upload to raspberry pi, unpack it, install required dependency and run one of the puppeteer example to check that it works and please share your feedback!

@ak239 Do you mean that sudo apt-get install chromium-browser was finally not be able to download the latest version? Can youn explain how to install recent Chrome browser for Pi?

rclai commented

Is there no ARM build of Chrome? @ak239 are you able to type up instructions of how your compiled Chrome for ARM?

@ak239 your build is working fine here on a RPi2 on Raspbian, while the official build gave me the ELF error, so I assume there's no armv6 binary build of Chrome being downloaded.

@ak239 did another attempt, this time on a RPi3 (armv7) running Arch Linux ARM with no GUI libraries present (shell only). I had to install the following GUI-related libraries until I was able to run the chrome binary: pango libxcomposite libxss libxrandr gconf atk gtk3. After that, I was able to run the PDF and screenshot examples fine.

Thanks a lot!

I build Chromium for arm using recipe 2 from here.

Before start I have Chromium checkout for regular Linux build, I added target_cpu = "arm" to gn flags, run following code and build using ninja.
./build/linux/sysroot_scripts/install-sysroot.py --arch=arm

I don't have any estimations when we'll get arm build support as part of npm install but we have it in our list.

Hi
i got this error
(node:2323) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: spawn EACCES
(node:2323) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I found that in raspbian stretch , chromium version 60 is preinstalled
and chromium-headless works with command line
chromium-browser --headless --disable-gpu --print-to-pdf https://www.google.com
how could i use built in chromium for puppeteer?
@ak239 @silverwind

wget http://launchpadlibrarian.net/341807203/chromium-browser_62.0.3202.62-0ubuntu0.14.04.1204_armhf.deb
wget http://launchpadlibrarian.net/341807199/chromium-codecs-ffmpeg-extra_62.0.3202.62-0ubuntu0.14.04.1204_armhf.deb
sudo dpkg -i chromium-browser_62.0.3202.62-0ubuntu0.14.04.1204_armhf.deb
sudo dpkg -i chromium-codecs-ffmpeg-extra_62.0.3202.62-0ubuntu0.14.04.1204_armhf.deb
cat > test.js <<EOF
const puppeteer = require('puppeteer');
(async () => {
        const browser = await puppeteer.launch({executablePath: '/usr/bin/chromium-browser'});
        const page = await browser.newPage();
        await page.goto('https://example.com');
        await page.screenshot({path: 'example.png'});
        await browser.close();
})();
EOF
node test.js

@jindongh Do you have any arm build of the latest version from chromium-dev channel? Last week it was added a new domain called HeadlessExperimental which Im really interested on testing, although Im not sure whether it's working or not.

@jindongh I still get a freezing response and nothing happens. I do not have any problem using chromeless but puppeteer has a lot more features.

I setup remote debugging to my raspberry pi and tried to play with this behavior for a while (I am no expert at this, just curious and want to learn more). When I go step by step I get to the newPage() method in Browser.js, around line 100, where it has console.assert(await target._initializedPromise, 'Failed to create target for page'); (note that it doesn't log that 'Failed to create ...' message to the console). If I step once more after that line it takes me to bootstrap_node.js in the setupGlobalConsole() method, at the line return wrappedConsole. After that it just does nothing. If I change line 100 to just await target._initializedPromise then it stops there since it doesn't need the console.

@jindongh comment works, but only with puppeteer v0.10.0

This init code works:
const browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox', '--headless', '--disable-gpu'], executablePath: '/usr/bin/chromium-browser'});
Here's the list of configs I have tried on Raspberry Pi

puppeteer v0.10.0, /usr/bin/chromium-browser -> works
puppeteer v0.12.0, /usr/bin/chromium-browser -> NOT working, freeze at newPage
puppeteer v0.13.0, /usr/bin/chromium-browser -> NOT working, freeze at newPage

puppeteer v0.10.0, chrome in /node-modules -> NOT working, Error: Failed to launch chrome!
puppeteer v0.12.0, chrome in /node-modules -> NOT working, Error: Failed to launch chrome!
puppeteer v0.13.0, chrome in /node-modules -> NOT working, Error: Failed to launch chrome!
(all Debian dependencies are installed)

node v8.9.1
chromium-browser_62 (downloaded with @jindongh comment)
Linux raspberrypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l GNU/Linux

@torinnguyen, I have the same issue...

@ak239 Is there a build for the pi zero? Seems to only work for me on Pi3 and not the zero.

@ak239 I have the same issue.

On OSX I solved the problem doing the following:

  1. Add to the code
const { CHROME_BIN } = process.env;
const browser = await puppeteer.launch(Object.assign({}, PUPPETEER_CONFIG, { executablePath: CHROME_BIN }));
  1. brew install -g puppeteer, which downloaded the specific compatible version of Chromium on ~/.npm-packages/lib/node_modules/puppeteer/.local-chromium/mac-508693/chrome-mac/Chromium.app/Contents/MacOS/Chromium, I then set CHROME_BIN='.npm-packages/lib/node_modules/puppeteer/.local-chromium/mac-508693/chrome-mac/Chromium.app/Contents/MacOS/Chromium' on my ~/.bashrc

and it worked!

@torinnguyen and others using Raspberry Pi and trying to get screen captures or make pdfs here is what I was able to make work. The issue is the version provided by the latest version from Debian Stretch is 63.0.x which is outdated compared to where this library currently is. So the solution is to manually update the Pi's version of Chromium so it will work with the latest version of this library. The version downloaded into the node_modules library will not work due to it not having support for Arm (as previously mentioned in other comments and issues). As of puppeteer v1.0.0 you will get ELF errors when trying to launch that version.

First step is to look at the release notes and see what version of chrome is supported for the release of this library. For version 1.0.0 the supported Chromium version is 65. For version 0.13.0 the supported version is 64 and so on down. Check the releases for the versions supported.

Next step is to find the version of Chromium for your Pi that is newer than the stable 63, which is not exactly straight forward. I have only tested downloading the files directly from the chromium-team site on launchpad and installing them. They also have instructions on how to add the PPA to your system but I have not ventured that far yet. As of right now if you want to use the latest version 65 (v1.0.0) you will need to go to the "dev" section. The "beta" section is Chrome 64 (v0.12.0) and stable is 63 (v0.11.0) which you should have if you have updated your version of debian. When you go to the section you want you will need to click on View package details, This will give you a list of the different ubuntu versions available. Click on the one you want (I used 14 for my testing) and then scroll down to the link for armhf and click it. This will give you all the files available for that version of ubuntu and Chromium that will run on the Pi.

For which ever version of Chromium you want to install the idea is the same just replace the example here with the files you downloaded. Also you need to install the chromium-codecs-ffmpeg package first before trying to install the actual chromium-browser package. This example is for the dev version, Chromium 65. I used the ubuntu 14 (Trusty) versions and had no issues creating images or pdfs.

wget https://launchpad.net/~chromium-team/+archive/ubuntu/dev/+build/14258758/+files/chromium-codecs-ffmpeg_65.0.3322.3-0ubuntu0.14.04.1_armhf.deb; sudo dpkg -i chromium-codecs-ffmpeg_65.0.3322.3-0ubuntu0.14.04.1_armhf.deb

wget https://launchpad.net/~chromium-team/+archive/ubuntu/dev/+build/14258758/+files/chromium-browser_65.0.3322.3-0ubuntu0.14.04.1_armhf.deb; sudo dpkg -i chromium-browser_65.0.3322.3-0ubuntu0.14.04.1_armhf.deb

I used the following code in test.js (thanks @jindongh) to make sure the installed version would launch without issue, take a screen capture and save it as an image.

const puppeteer = require('puppeteer');
(async () => {
        const browser = await puppeteer.launch({executablePath: '/usr/bin/chromium-browser'});
        const page = await browser.newPage();
        await page.goto('https://example.com');
        await page.screenshot({path: 'example.png'});
        await browser.close();
})();

You just run it with node test.js and it should create a example.png file with a screen capture of example.com. If you see no errors check the example.png and there should be an image of the web page. If so then that version of puppeteer is working properly.

If anyone tests out the PPA installed version please let me/us know how it goes and if it is a better solution. I did not want to do it to prevent future "dev" updates from chromium breaking something in production. My production version is still using the stable version 63 of the chromium-l10n library that comes from debian. It seems like the version doesn't matter too much as the browser launches fine but it would be nice to get an updated version of that library to match the installed version.

Edit: Changed to ubuntu 14 (Trusty) as that is the normal version used for my PI & typo in deb command.

jor3l commented

This worked for me (updated @Austinb with the now beta channel):

wget https://launchpad.net/~chromium-team/+archive/ubuntu/beta/+build/14381587/+files/chromium-codecs-ffmpeg_65.0.3325.88-0ubuntu0.17.10.1_armhf.deb; sudo dpkg -i chromium-codecs-ffmpeg_65.0.3325.88-0ubuntu0.17.10.1_armhf.deb
wget https://launchpad.net/~chromium-team/+archive/ubuntu/beta/+build/14381587/+files/chromium-browser_65.0.3325.88-0ubuntu0.17.10.1_armhf.deb; sudo dpkg -i chromium-browser_65.0.3325.88-0ubuntu0.17.10.1_armhf.deb

@Austinb's solution works for me too with puppeteer v1.13 and chromium 65 from dev channel !

Adding latest chrome version to stay inline with puppeteer v1.2.0 release:
wget https://launchpad.net/~chromium-team/+archive/ubuntu/dev/+build/14506458/+files/chromium-codecs-ffmpeg_67.0.3381.0-0ubuntu1_armhf.deb; sudo dpkg -i chromium-codecs-ffmpeg_67.0.3381.0-0ubuntu1_armhf.deb

These are slightly updated versions of the links that @jor3l posted:

wget https://launchpad.net/~canonical-chromium-builds/+archive/ubuntu/stage/+build/14482955/+files/chromium-codecs-ffmpeg_65.0.3325.181-0ubuntu0.14.04.1_armhf.deb; sudo dpkg -i chromium-codecs-ffmpeg_65.0.3325.181-0ubuntu0.14.04.1_armhf.deb
wget https://launchpad.net/~canonical-chromium-builds/+archive/ubuntu/stage/+build/14482955/+files/chromium-browser_65.0.3325.181-0ubuntu0.14.04.1_armhf.deb; sudo dpkg -i chromium-browser_65.0.3325.181-0ubuntu0.14.04.1_armhf.deb

Since this issue has gotten some action in the last week it appears that 65 maybe the last version for the 14.x series. Version 66 is available in the beta for 16 and 17 now so its possible if you are running 14 you may run into compatibility issues until the PI's version is updated to the 16 LTS base. You maybe able to use the non Ubuntu specific version like 67.0.3381.0-0ubuntu2 but I have not tested it.

I still have not tested using the PPA so that your version is updated without having to find the files. Beware this may break your system!

sudo add-apt-repository ppa:chromium-team/beta
sudo apt-get update

There is also a I10n library available for 65 which should probably be installed as well if you have language issues with the 63 version installed by default.

Any update on a fix for this? I'm in a "dependency hell" and I cannot make it run on Raspbian Stretch.

@napolux instead of using the default chromium v63 that comes with raspbian stretch, use v65 and you should be good to go for now.

@vinaynb Looks like I can't install version 65. Any idea?

sudo apt-cache policy chromium-browser
chromium-browser:
  Installed: (none)
  Candidate: 60.0.3112.89-0ubuntu0.14.04.1.1010+1
  Version table:
     60.0.3112.89-0ubuntu0.14.04.1.1010+1 500
        500 http://archive.raspberrypi.org/debian stretch/main armhf Packages

It won't be available through apt-get, you will need to download and install the new version manually. See @scissorsneedfoodtoo 's comment above for commands to do that. #550 (comment)

Also, be sure to change the runtime settings when launching the browser. Once you download the new version of Chromium with wget, change const browser = await puppeteer.launch(); to const browser = await puppeteer.launch({executablePath: '/usr/bin/chromium-browser'});.

Check #550 (comment) for more details.

For the benefit of others that may arrive here looking for answers...

Upgraded Raspberry Pi 3 to stretch. That installed this version of chromium-browser:

Chromium 65.0.3325.181 Built on Raspbian , running on Raspbian 9.4

Using puppeteer@1.5.0, this version of chromium-browser works for my use case (fast-cli@2.2.0). I did modify puppeteer.launch arguments per #550 (comment).

For anyone here working on Raspbery Pi Zero, the above instructions will not work because the chromium-team arm binary is for armv7, which the pi 3 has (not previous versions).

After trying all night, all I could get was:

$ chromium-browser --version
Illegal Instruction

The solution is just to use the chromium browser in the default repositories (version 65 on stretch raspian).

apt-get update && apt-get install chromium-browser

@Austinb
Installing the ppa doesn't work for me.

Here is the traceback I get -

$ apt-get update && apt-get install -y software-properties-common && add-apt-repository -y ppa:chromium-team/stable
Get:1 http://archive.raspberrypi.org jessie InRelease [22.9 kB]
Get:2 http://archive.raspbian.org jessie InRelease [14.9 kB]
Get:3 http://archive.raspberrypi.org jessie/main armhf Packages [171 kB]
Get:4 http://archive.raspbian.org jessie/main armhf Packages [13.3 MB]
Get:5 http://archive.raspbian.org jessie/contrib armhf Packages [49.5 kB]
Get:6 http://archive.raspbian.org jessie/non-free armhf Packages [101 kB]
Get:7 http://archive.raspbian.org jessie/rpi armhf Packages [1297 B]
Get:8 http://archive.raspbian.org jessie/firmware armhf Packages [1208 B]
Fetched 13.7 MB in 1min 42s (134 kB/s)




The following extra packages will be installed:
  apt-utils dh-python gir1.2-glib-2.0 iso-codes libapt-inst1.5
  libgirepository-1.0-1 libmpdec2 libpython3-stdlib libpython3.4-minimal
  libpython3.4-stdlib lsb-release python-apt-common python3 python3-apt
  python3-dbus python3-gi python3-minimal python3-software-properties
  python3.4 python3.4-minimal unattended-upgrades
Suggested packages:
  isoquery lsb python3-doc python3-tk python3-venv python3-apt-dbg
  python-apt-doc python-dbus-doc python3-dbus-dbg python3.4-venv python3.4-doc
  binfmt-support bsd-mailx mail-transport-agent
The following NEW packages will be installed:
  apt-utils dh-python gir1.2-glib-2.0 iso-codes libapt-inst1.5
  libgirepository-1.0-1 libmpdec2 libpython3-stdlib libpython3.4-minimal
  libpython3.4-stdlib lsb-release python-apt-common python3 python3-apt
  python3-dbus python3-gi python3-minimal python3-software-properties
  python3.4 python3.4-minimal software-properties-common unattended-upgrades
0 upgraded, 22 newly installed, 0 to remove and 14 not upgraded.
Need to get 8326 kB of archives.
After this operation, 39.1 MB of additional disk space will be used.
Get:1 http://archive.raspbian.org/raspbian/ jessie/main libapt-inst1.5 armhf 1.0.9.8.4 [166 kB]
Get:2 http://archive.raspbian.org/raspbian/ jessie/main libmpdec2 armhf 2.4.1-1 [65.8 kB]
Get:3 http://archive.raspbian.org/raspbian/ jessie/main libpython3.4-minimal armhf 3.4.2-1 [483 kB]
Get:4 http://archive.raspbian.org/raspbian/ jessie/main libpython3.4-stdlib armhf 3.4.2-1 [2011 kB]
Get:5 http://archive.raspbian.org/raspbian/ jessie/main python3.4-minimal armhf 3.4.2-1 [1355 kB]
Get:6 http://archive.raspbian.org/raspbian/ jessie/main apt-utils armhf 1.0.9.8.4 [353 kB]
Get:7 http://archive.raspbian.org/raspbian/ jessie/main python3.4 armhf 3.4.2-1 [204 kB]
Get:8 http://archive.raspbian.org/raspbian/ jessie/main python3-minimal armhf 3.4.2-2 [34.7 kB]
Get:9 http://archive.raspbian.org/raspbian/ jessie/main libpython3-stdlib armhf 3.4.2-2 [18.1 kB]
Get:10 http://archive.raspbian.org/raspbian/ jessie/main python3 armhf 3.4.2-2 [21.2 kB]
Get:11 http://archive.raspbian.org/raspbian/ jessie/main dh-python all 1.20141111-2 [66.4 kB]
Get:12 http://archive.raspbian.org/raspbian/ jessie/main libgirepository-1.0-1 armhf 1.42.0-2.2 [82.9 kB]
Get:13 http://archive.raspbian.org/raspbian/ jessie/main gir1.2-glib-2.0 armhf 1.42.0-2.2 [141 kB]
Get:14 http://archive.raspbian.org/raspbian/ jessie/main iso-codes all 3.57-1 [2265 kB]
Get:15 http://archive.raspbian.org/raspbian/ jessie/main lsb-release all 4.1+Debian13+rpi1+nmu1 [26.7 kB]
Get:16 http://archive.raspbian.org/raspbian/ jessie/main python-apt-common all 0.9.3.12 [89.9 kB]
Get:17 http://archive.raspbian.org/raspbian/ jessie/main python3-apt armhf 0.9.3.12 [154 kB]
Get:18 http://archive.raspbian.org/raspbian/ jessie/main python3-dbus armhf 1.2.0-2+b1 [186 kB]
Get:19 http://archive.raspbian.org/raspbian/ jessie/main python3-gi armhf 3.14.0-1 [436 kB]
Get:20 http://archive.raspbian.org/raspbian/ jessie/main unattended-upgrades all 0.81+rpi1 [45.7 kB]
Get:21 http://archive.raspbian.org/raspbian/ jessie/main python3-software-properties all 0.92.25debian1 [41.4 kB]
Get:22 http://archive.raspbian.org/raspbian/ jessie/main software-properties-common all 0.92.25debian1 [79.3 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 8326 kB in 59s (141 kB/s)

(Reading database ... 18646 files and directories currently installed.)


Selecting previously unselected package libmpdec2:armhf.


Selecting previously unselected package libpython3.4-minimal:armhf.


Selecting previously unselected package libpython3.4-stdlib:armhf.


Selecting previously unselected package python3.4-minimal.
Preparing to unpack .../python3.4-minimal_3.4.2-1_armhf.deb ...
Unpacking python3.4-minimal (3.4.2-1) ...
Selecting previously unselected package apt-utils.


Selecting previously unselected package python3.4.


Selecting previously unselected package python3-minimal.


Selecting previously unselected package libpython3-stdlib:armhf.


Selecting previously unselected package python3.


Selecting previously unselected package dh-python.


Selecting previously unselected package libgirepository-1.0-1:armhf.


Selecting previously unselected package gir1.2-glib-2.0:armhf.


Selecting previously unselected package iso-codes.

Unpacking iso-codes (3.57-1) ...
Selecting previously unselected package lsb-release.


Selecting previously unselected package python-apt-common.


Selecting previously unselected package python3-apt.




Unpacking python3-dbus (1.2.0-2+b1) ...
Selecting previously unselected package python3-gi.

Unpacking python3-gi (3.14.0-1) ...
Selecting previously unselected package unattended-upgrades.
Preparing to unpack .../unattended-upgrades_0.81+rpi1_all.deb ...
Unpacking unattended-upgrades (0.81+rpi1) ...
Selecting previously unselected package python3-software-properties.


Selecting previously unselected package software-properties-common.





Setting up libmpdec2:armhf (2.4.1-1) ...

Setting up libpython3.4-stdlib:armhf (3.4.2-1) ...
Setting up python3.4-minimal (3.4.2-1) ...
Setting up apt-utils (1.0.9.8.4) ...
Setting up python3.4 (3.4.2-1) ...
Setting up python3-minimal (3.4.2-2) ...
Setting up libpython3-stdlib:armhf (3.4.2-2) ...
Setting up libgirepository-1.0-1:armhf (1.42.0-2.2) ...
Setting up gir1.2-glib-2.0:armhf (1.42.0-2.2) ...
Setting up iso-codes (3.57-1) ...
Setting up lsb-release (4.1+Debian13+rpi1+nmu1) ...
Setting up python-apt-common (0.9.3.12) ...





Setting up unattended-upgrades (0.81+rpi1) ...





Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 167, in <module>
    sp = SoftwareProperties(options=options)
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 105, in __init__
    self.reload_sourceslist()
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 595, in reload_sourceslist
    self.distro.get_sources(self.sourceslist)    
  File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 89, in get_sources
    (self.id, self.codename))
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Raspbian/jessie

Following the instructions throughout this, and a bit of experimentation got me here:

Device & OS: Raspberry Pi B 3+, Raspbian (Stretch)
Chromium version: 65.0.x
Puppeteer version: 1.5.0
Node version: 10.10.0
Launch settings:

const browser = await puppeteer.launch({
    args: ['--no-sandbox', '--disable-setuid-sandbox', '--headless', '--disable-gpu'],
    executablePath: '/usr/bin/chromium-browser'
})

Error:

(node:20627) UnhandledPromiseRejectionWarning: Error: Evaluation failed: SyntaxError: Unexpected token {
    at ExecutionContext.evaluateHandle (/home/pi/Documents/forex-trader/node_modules/puppeteer/lib/ExecutionContext.js:88:13)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:20627) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:20627) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Now, I'm pretty sure that this is a dependancy problem, but I can't work it out. Has anyone else got it working recently?

Raspbian 9.4 stretch, armv7l Linux 4.14.71-v7+
puppeteer: 1.9.0
chromium-browser_71.0.3554.0-0ubuntu0.16.04.1_armhf.deb

wget https://launchpad.net/~chromium-team/+archive/ubuntu/dev/+build/15468703/+files/chromium-codecs-ffmpeg_71.0.3554.0-0ubuntu0.16.04.1_armhf.deb && sudo dpkg -i chromium-codecs-ffmpeg_71.0.3554.0-0ubuntu0.16.04.1_armhf.deb
wget https://launchpad.net/~chromium-team/+archive/ubuntu/dev/+build/15468703/+files/chromium-browser_71.0.3554.0-0ubuntu0.16.04.1_armhf.deb && sudo dpkg -i chromium-browser_71.0.3554.0-0ubuntu0.16.04.1_armhf.deb

For first time Chromium didn't find some deps.
After sudo apt-get --fix-broken install run and browser reinstall, my puppeteer scripts start working with executablePath changed.

update.
new links for chromium 71, working with 1.9.0

wget https://launchpad.net/~chromium-team/+archive/ubuntu/beta/+build/15690067/+files/chromium-codecs-ffmpeg_71.0.3578.62-0ubuntu0.16.04.1_armhf.deb
wget https://launchpad.net/~chromium-team/+archive/ubuntu/beta/+build/15690067/+files/chromium-browser_71.0.3578.62-0ubuntu0.16.04.1_armhf.deb

I wrote this short article explaining how to tackle the problem for the moment:

https://code-flow-hjbello.blogspot.com/2018/11/make-puppeteer-work-with-raspbian-vers.html

It combines various of the answers given here and works for me.

Carefull when you download and install chrome 65 and its codes, some links above do not work any more, the right ones are:

wget http://launchpadlibrarian.net/361669485/chromium-browser_65.0.3325.181-0ubuntu0.14.04.1_armhf.deb; sudo dpkg -i chromium-browser_65.0.3325.181-0ubuntu0.14.04.1_armhf.deb

wget http://launchpadlibrarian.net/361689926/chromium-codecs-ffmpeg_65.0.3325.181-0ubuntu0.16.04.1_armhf.deb; sudo dpkg -i chromium-codecs-ffmpeg_65.0.3325.181-0ubuntu0.16.04.1_armhf.deb

trying to do simple commands
await page.goto('http://localhost:8888'), await page.click('#login-button'), await page.waitForNavigation()
but the page.click throws unhandled promise rejection error.
any ideas?

Fresh update to this issue for those doing a fresh install:

  • Stretch includes chromium-browser 65. sudo apt install chromium-browser chromium-codecs-ffmpeg
  • puppeteer-core@v1.11.0 "stable" is the one that works with chromium-browser version 65
  • const puppeteer = require('puppeteer-core');
  • const browser = await puppeteer.launch({executablePath: '/usr/bin/chromium-browser'});

I have no trouble with the extra args that were suggested earlier (disable sandbox, gpu, etc) but I found that it works either way now. So just "executablePath" should do it.

The other thing I did was install the packages on the troubleshooting page: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md where you can "sudo apt install" the packages listed under "Debian (e.g. Ubuntu) Dependencies". Here is the current version if you just want to copy-and-paste.

sudo apt install gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget

@ryanweal Your solution works for me. Thanks.

However, I had to add --no-sandbox argument to the chromium browser puppeteer.launch({args:['--no-sandbox'], executablePath:'chromium-browser'}); No need to specify the full path.

I'm using headless Raspbian Stretch Lite.

is anyone having experience about typical using on termux of ARM build?
the default chromium download by pyppeteer will cause error:

OSError: [Errno 8] Exec format error: '/data/data/com.termux/files/home/.local/share/pyppeteer/local-chromium/575458/chrome-linux/chrome'

and it was mistaken by not to check the system architecture first:

$ file /data/data/com.termux/files/home/.local/share/pyppeteer/local-chromium/575458/chrome-linux/chrome

/data/data/com.termux/files/home/.local/share/pyppeteer/local-chromium/575458/chrome-linux/chrome: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, not stripped

did anyone figure out the issue with page.click()? I am getting

(node:9279) UnhandledPromiseRejectionWarning: Error: Node is either not visible or not an HTMLElement
    at ElementHandle._clickablePoint (/home/pi/node_modules/puppeteer-core/lib/ExecutionContext.js:349:13)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  -- ASYNC --
    at ElementHandle.<anonymous> (/home/pi/node_modules/puppeteer-core/lib/helper.js:144:27)
    at Frame.click (/home/pi/node_modules/puppeteer-core/lib/FrameManager.js:737:18)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  -- ASYNC --
    at Frame.<anonymous> (/home/pi/node_modules/puppeteer-core/lib/helper.js:144:27)
    at Page.click (/home/pi/node_modules/puppeteer-core/lib/Page.js:973:29)
    at /home/pi/Code/SteamAutoSell/watch.js:105:14
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:9279) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:9279) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

when I run a page.click().

@Justsoos you need to do the stuff ryanweal put 15 days ago

@aslushnikov I understand that you are not planning any ARM builds for chromium yet, but it would be great to have aarch64 support present for the puppeteer. As it is already discussed in this issue chromium-browser binary works fine over aarch64 if you could provide that over the URL from where currently used chromium binary is being downloaded then this could work.
Please share your thoughts on this.

Small update, using slightly newer versions and working great on my rpi3 b+.

Raspbian 9.8 stretch, Linux rpi3b+ 4.14.79-v7+ armv7
puppeteer-core@1.12.0
Chromium 73.0.3683.75 Built on Ubuntu

I couldn't find the ppter v1.13 corresponding Chromium version 74.0.3723.0 in the beta channel.

To get the chromium binaries from the above link, choose your ubuntu desired release and follow the links. Here are the ones I chose for Xenial, armhf, Chromium, codecs-ffmpeg, codecs-ffmpeg-extra.

Before I installed the three above pkgs manually, I installed the deps mentioned in this post above.

@aboulfad The links are not working, can you change them?

@aboulfad The links are not working, can you change them?

That’s because the maintainers have removed those older builds. Browse the beta channel for newer builds.

@aboulfad Is it possible to take over all the commands to install puppeteteer and chromium-browser on rpi3?

@LeMoussel , not sure what you need, but my post above shows where to get whichever versions of chromium from beta channel. If you don’t know apt, I suggest you read up a bit on it. Examples were given in post #550

@aboulfad, in summary

Install the necessary debian dependencies
installed the deps mentioned in this post #550 above.

Install Chromium browser
sudo add-apt-repository ppa:chromium-team/beta
sudo apt-get update

Install Chromium browser codecs
sudo apt-get codecs-ffmpeg
sudo apt-get codecs-ffmpeg-extra

Fix broken packages
sudo apt-get --fix-broken install

Is that correct?

Install Chromium browser
sudo add-apt-repository ppa:chromium-team/beta
...
Is that correct?

When I installed chromium on my rpi3, I downloaded and installed the binary manually from the beta channel. I dont know which version of chromium you will get by adding the beta repo. Regardless, make sure chromium version meets puppeteer's version requirement. Aside from that, I think you got it.

Okay, but then I don't understand how to download and install the Chromium binary manually from the beta channel.
I think you used wget but with which url?

^^^ you don’t have to manually download if you can find a ppa containing the version u need.

But if you want to do so manually, as mentioned in my previous posts, browse the beta channel and locate the binary build for armhf architecture.

I filtered for Xenial series, then chose the armhf build.

This link works https://launchpad.net/~chromium-team/+archive/ubuntu/beta?field.series_filter=xenial,

Then choose “view package details”, Xenial, armhf. Here is the final link:
https://launchpad.net/~chromium-team/+archive/ubuntu/beta/+build/16587669

All,

I wrote a Dockerfile, in order to be able to use Puppeteer on my rPi3
You can find the Dockerfile @
https://github.com/brechtvm/puppeteer/blob/master/Dockerfile

Hope this helps!

Whats the current status on armhf support.
Is it possible to do a work around to get it running on armhf (Raspberry Pi)?

Would it be possible to install chromium-browser from Ubuntu Launchpad armhf plattform and tell puppeteer to use that browser instead of /usr/local/share/.config/yarn/global/node_modules/puppeteer/.local-chromium/linux-672088/. Unfortunatelly I dont know what files to edit.

To use Puppeteer with a different version of Chrome or Chromium, pass in the executable's path when creating a Browser instance: const browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});

See puppeteer.executablePath() for more information.

Feel like I've tried everything trying to get puppeteer working on the Pi. I'm currently using the default Chrome 74 installation and pointing puppeteer core there using the executablePath option but I get Error: Protocol error (Runtime.callFunctionOn): Target closed. and the chrome that comes with puppeteer doesn't work either. I'm struggling to get normal Chrome to run successfully even without puppeteer. It was throwing Xlib errors which I got around by using DISPLAY=:0 before running it but then it just crashes with random errors any time I start chromium 😢 anyone got any advice?

I'm having similar problems with using Puppeteer (or even just starting headless chromium) on the Pi 4.

chromium-browser --headless --remote-debugging-port=9222 --disable-gpu --disable-extensions about:blank
 --disable-quic --enable-tcp-fast-open --ppapi-flash-path=/usr/lib/chromium-browser/libpepflashplayer.so --ppapi-flash-args=enable_stagevideo_auto=0 --ppapi-flash-version=

DevTools listening on ws://127.0.0.1:9222/devtools/browser/1dd00d98-422d-4da2-bdea-03241066cb70
X Error:  BadDrawable
  Request Major code 55 ()
  ResourceID 0x0
  Error Serial #144
  Current Serial #146
X Error:  BadDrawable
  Request Major code 55 ()
  ResourceID 0x0
  Error Serial #144
  Current Serial #146
X Error:  BadDrawable
  Request Major code 55 ()
  ResourceID 0x0
  Error Serial #144
  Current Serial #146
[1107/163647.389904:FATAL:gpu_data_manager_impl_private.cc(897)] The display compositor is frequently crashing. Goodbye.
Trace/breakpoint trap

I've tried running from a terminal with no display, a virtual display started with Xvfb, a desktop started with VNC, and running xvfb-run chromium-browser ...

Headless always results in the output shown above. If I don't run headless, it starts and launches the browser fine with no error messages in the terminal where it was started. I've had a difficult time finding other versions of Chromium compiled for armv7 to test, but the version from much earlier in this thread (chrome 63) seems to start headless without any problems, and I can connect from a browser to the debug environment, but I hit some other issues when using Puppeteer (I suspect due to the much older version of the browser)

Any thoughts on what I can try? I've tried disabling extensions, as well as disabling the gpu (via settings in the browser as well as the command line argument illustrated above).

FYI - I came up with a solution that seems to work for me with the existing chromium build. Instead of running with the --headless option, I start an Xvfb display, then point chromium to that with --display=:1

This effectively runs headless anyway, but avoids the issues with using the --headless flag. Everything appears to be working as expected now.

Xvfb :1 -screen 0 1920x1080x24 &

Puppeteer call to launch Chromium is now:
puppeteer.launch({defaultViewport: {height: 1080, width: 1920}, headless: false, args: ['--display=:1', '--no-sandbox', '--disable-extensions'], executablePath: '/usr/bin/chromium-browser'});

Xvfb :1 -screen 0 1920x1080x24 &

Puppeteer call to launch Chromium is now:
puppeteer.launch({defaultViewport: {height: 1080, width: 1920}, headless: false, args: ['--display=:1', '--no-sandbox', '--disable-extensions'], executablePath: '/usr/bin/chromium-browser'});

This worked for me too, many thanks!

I don't know how these comments are not linked here:

@ablears:

Try using your chromium-browser, rather than Puppeteer's chrome which might not work on the PI's ARM architecture.

const browser = await puppeteer.launch({ executablePath: 'chromium-browser' });

I had to do this on a PI 4.

@ibrcic:

For anyone for whom the above mentioned solution doesn't work, make sure that you have chromium installed on your RPI or install it using.

sudo apt-get install chromium-browser --yes

if you have box86 installed try to add box86 in the path it maybe work i did not test

This worked for me. I had to fix a dependency with ffmpeg afterwards though. That was easily fixed with aptitude.

Having installed the chromium dependency, I used { executablePath: 'chromium' } and it worked.

wget http://launchpadlibrarian.net/341807203/chromium-browser_62.0.3202.62-0ubuntu0.14.04.1204_armhf.deb
wget http://launchpadlibrarian.net/341807199/chromium-codecs-ffmpeg-extra_62.0.3202.62-0ubuntu0.14.04.1204_armhf.deb
sudo dpkg -i chromium-browser_62.0.3202.62-0ubuntu0.14.04.1204_armhf.deb
sudo dpkg -i chromium-codecs-ffmpeg-extra_62.0.3202.62-0ubuntu0.14.04.1204_armhf.deb
cat > test.js <<EOF
const puppeteer = require('puppeteer');
(async () => {
        const browser = await puppeteer.launch({executablePath: '/usr/bin/chromium-browser'});
        const page = await browser.newPage();
        await page.goto('https://example.com');
        await page.screenshot({path: 'example.png'});
        await browser.close();
})();
EOF
node test.js

This worked for me on my Raspberry PI B+.

First, I removed the old chromium pre-installed, and then installed it again (just in case). No idea if dependencies are needed as I tried different solutions before this, and may have them pre-installed before doing this)

Then created a brand new folder

mkdir New_Folder
cd New_Folder/

Then set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" to true:

export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true

Then installed puppeteer:

npm i puppeteer

Then checked that puppeteer didn't install any browser (there shouldn't be any ".local-chromium" or anything like that):

ls -a node_modules/puppeteer/

Then created a new example.js file to test if it works. Copied the code quoted above:

cat > test.js <<EOF
const puppeteer = require('puppeteer');
(async () => {
        const browser = await puppeteer.launch({executablePath: '/usr/bin/chromium-browser'});
        const page = await browser.newPage();
        await page.goto('https://example.com');
        await page.screenshot({path: 'example.png'});
        await browser.close();
})();
EOF

Then run it

node test.js

If no errors, you should see no console messages here

Finally to check, do

ls

And you should see a file called "example.png" that is a screenshot of the web above "https://example.com"

Fresh update to this issue for those doing a fresh install:

  • Stretch includes chromium-browser 65. sudo apt install chromium-browser chromium-codecs-ffmpeg
  • puppeteer-core@v1.11.0 "stable" is the one that works with chromium-browser version 65
  • const puppeteer = require('puppeteer-core');
  • const browser = await puppeteer.launch({executablePath: '/usr/bin/chromium-browser'});

I have no trouble with the extra args that were suggested earlier (disable sandbox, gpu, etc) but I found that it works either way now. So just "executablePath" should do it.

The other thing I did was install the packages on the troubleshooting page: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md where you can "sudo apt install" the packages listed under "Debian (e.g. Ubuntu) Dependencies". Here is the current version if you just want to copy-and-paste.

sudo apt install gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget

Hi I'm getting the same issue but with prerender-spa-plugin, I couldn't find where it's using puppeteer so can't replace const browser like this const browser = await puppeteer.launch({executablePath: '/usr/bin/chromium-browser'}); any idea how I can fix it in my case? :( much appreaciated!

@paulinechi If you can figure out where the default puppeteer path is you might be able to symlink it to /usr/bin/chromium-browser. I don't know where that is though.

stale commented

We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days.

This is is definitely still an issue, puppeteer still doesn't download and use a bundled version of chromium on arm architectures.

stale commented

We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days.

Still an issue.

OrKoN commented

There is PUPPETEER_EXPERIMENTAL_CHROMIUM_MAC_ARM flag now to download mac ARM builds but as far as I know there no other ARM builds published by Chromium.

You can run it inside a docker container on raspberrypi to fix the issue if you want to know more about this just reply and I'll develop

Duplicate of #7740