puppeteer: UnhandledPromiseRejectionWarning: Error: Failed to launch chrome!
Steps to reproduce
Tell us about your environment:
- Puppeteer version: 1.3.0
- Platform / OS version: Ubuntu 16.04.3 LTS
- URLs (if applicable): https://github.com/Astro36/KoreanSchool/blob/master/lib/index.js#L238 (line:238)
- Node.js version: v9.6.0
I already install Ubuntu dependencies by below command.
sudo apt-get install gconf-service libasound2 libatk1.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
What steps will reproduce the problem?
Please include code that reproduces the issue.
- Run
const browser = await puppeteer.launch();
- Error occured.
What is the expected result?
Launch the chrome.
What happens instead?
(node:9952) UnhandledPromiseRejectionWarning: Error: Failed to launch chrome! /home/odroid/Programs/KoreanSchool-ScheduleBot/node_modules/korean-school/node_modules/puppeteer/.local-chromium/linux-549031/chrome-linux/chrome: 1: /home/odroid/Programs/KoreanSchool-ScheduleBot/node_modules/korean-school/node_modules/puppeteer/.local-chromium/linux-549031/chrome-linux/chrome: Syntax error: Unterminated quoted string
TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
at onClose (/home/odroid/Programs/KoreanSchool-ScheduleBot/node_modules/korean-school/node_modules/puppeteer/lib/Launcher.js:255:14)
at Interface.helper.addEventListener (/home/odroid/Programs/KoreanSchool-ScheduleBot/node_modules/korean-school/node_modules/puppeteer/lib/Launcher.js:244:50)
at Interface.emit (events.js:130:15)
at Interface.close (readline.js:379:8)
at Socket.onend (readline.js:152:10)
at Socket.emit (events.js:130:15)
at endReadableNT (_stream_readable.js:1101:12)
at process._tickCallback (internal/process/next_tick.js:152:19)
(node:13165) 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:13165) [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.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 3
- Comments: 20 (2 by maintainers)
If you are running an ARM processor, e.g. Raspberry PI, as stated in the begning of this thread I solved the issue with the following:
Install Chromium by running:
sudo apt install chromium-browser chromium-codecs-ffmpeg
It usually installes Chromium in /usr/bin/ -folder. So then we change the executablePath to the below:
@KevinNovak pptr doesn’t support ARM out of the box. You’ll have to compile chromium for arm on your own and point pptr to use it with
executablePath
Sent with GitHawk
Hi im having the same issue I tried everything and nothings working, im so confused. can someone please help. I ran npm install pupteer and put this in my main file bot.js const browser = puppeteer.launch({ headless: true, executablePath: ‘node_modules/puppeteer/.local-chromium/win64-686378/chrome-win/chrome’, ‘args’: [‘–no-sandbox’, ‘–disable-setuid-sandbox’] }); its still not working when I put it on Heroku, what can I do to fix it? Ps. If you need to see more code just let me know! Thanks!
I also get the same error But it solves in my case.
When you are using headless: true options then also use the option executablePath give the accurate path of your chrome file in node_modules folder, like above. In my case I am putting whole path of my system, where my chrome file.
I love you man!
Also worked for me!
@aslushnikov Didn’t realize that. I ended up doing what you mentioned with
executablePath
using the version of Chromium that comes with Raspbian. Thanks!