Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't run puppeteer in centos7 #391

Closed
rlog opened this issue Aug 19, 2017 · 79 comments
Closed

can't run puppeteer in centos7 #391

rlog opened this issue Aug 19, 2017 · 79 comments
Labels

Comments

@rlog
Copy link

@rlog rlog commented Aug 19, 2017

Server Info:
CUP: Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz
MemTotal: 1016396 kB
OS:CentOS Linux release 7.3.1611 (Core)
Node:v8.4.0

when I try to run my app in this server, there have an error throw:

(node:29208) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed to connect to chrome!

I want run Chromium which download by puppeteer manual,there have some log output:

robin@eve ~/project/memostickyserver/node_modules/puppeteer/.local-chromium/linux-494755/chrome-linux (master*) $ chrome
robin@eve ~/project/memostickyserver/node_modules/puppeteer/.local-chromium/linux-494755/chrome-linux (master*) $ ./chrome
[28268:28268:0819/223159.486750:FATAL:zygote_host_impl_linux.cc(123)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
#0 0x7fd4bc6d6657 base::debug::StackTrace::StackTrace()
#1 0x7fd4bc6ea311 logging::LogMessage::~LogMessage()
#2 0x7fd4bb8db1f1 content::ZygoteHostImpl::Init()
#3 0x7fd4bb575da0 content::BrowserMainLoop::EarlyInitialization()
#4 0x7fd4bb57c4c3 content::BrowserMainRunnerImpl::Initialize()
#5 0x7fd4bb575532 content::BrowserMain()
#6 0x7fd4bc3e17fd content::ContentMainRunnerImpl::Run()
#7 0x7fd4bc3e9314 service_manager::Main()
#8 0x7fd4bc3e0462 content::ContentMain()
#9 0x7fd4bb020b74 ChromeMain
#10 0x7fd4b3da2b35 __libc_start_main
#11 0x7fd4bb0209d0

Received signal 6
#0 0x7fd4bc6d6657 base::debug::StackTrace::StackTrace()
#1 0x7fd4bc6d61cf base::debug::(anonymous namespace)::StackDumpSignalHandler()
#2 0x7fd4ba04d370
#3 0x7fd4b3db61d7 __GI_raise
#4 0x7fd4b3db78c8 __GI_abort
#5 0x7fd4bc6d5202 base::debug::BreakDebugger()
#6 0x7fd4bc6ea7cc logging::LogMessage::~LogMessage()
#7 0x7fd4bb8db1f1 content::ZygoteHostImpl::Init()
#8 0x7fd4bb575da0 content::BrowserMainLoop::EarlyInitialization()
#9 0x7fd4bb57c4c3 content::BrowserMainRunnerImpl::Initialize()
#10 0x7fd4bb575532 content::BrowserMain()
#11 0x7fd4bc3e17fd content::ContentMainRunnerImpl::Run()
#12 0x7fd4bc3e9314 service_manager::Main()
#13 0x7fd4bc3e0462 content::ContentMain()
#14 0x7fd4bb020b74 ChromeMain
#15 0x7fd4b3da2b35 __libc_start_main
#16 0x7fd4bb0209d0
r8: 00007fff21b42080 r9: 0000000000000395 r10: 0000000000000008 r11: 0000000000000206
r12: 00007fff21b424e0 r13: 000000000000016d r14: 00007fff21b424d8 r15: 00007fff21b424d0
di: 0000000000006e6c si: 0000000000006e6c bp: 00007fff21b42080 bx: 00007fff21b42080
dx: 0000000000000006 ax: 0000000000000000 cx: ffffffffffffffff sp: 00007fff21b41ed8
ip: 00007fd4b3db61d7 efl: 0000000000000206 cgf: 0000000000000033 erf: 0000000000000000
trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
Calling _exit(1). Core file will not be generated.
robin@eve ~/project/memostickyserver/node_modules/puppeteer/.local-chromium/linux-494755/chrome-linux (master*) $ ./chrome --no-sandbox
[0819/223234.158902:ERROR:nacl_helper_linux.cc(310)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly

pls help,how to fix this ?

@Garbee
Copy link
Contributor

@Garbee Garbee commented Aug 19, 2017

No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.

Right in the error output. Did you go to the referenced page and read what it says about the problem and how to address it?

@rlog
Copy link
Author

@rlog rlog commented Aug 20, 2017

@Garbee Thanks to replay

yes,I read that page and try:

sudo chown root:root chrome_sandbox && sudo chmod 4755 chrome_sandbox && \
    export CHROME_DEVEL_SANDBOX="$PWD/chrome_sandbox"

get some other error:

DevTools listening on ws://127.0.0.1:45565/devtools/browser/8b502ff1-9ad6-40c7-a335-ec9221e1d914
[0820/113237.953713:ERROR:devtools_http_handler.cc(245)] Error writing DevTools active port to file
[0820/113237.923530:FATAL:platform_font_linux.cc(83)] Check failed: InitDefaultFont(). Could not find the default font
#0 0x7f6fc457d657 base::debug::StackTrace::StackTrace()
#1 0x7f6fc4591311 logging::LogMessage::~LogMessage()
#2 0x7f6fc4aad472 gfx::PlatformFontLinux::PlatformFontLinux()
#3 0x7f6fc4aae436 gfx::PlatformFont::CreateDefault()
#4 0x7f6fc4aa68c9 gfx::Font::Font()
#5 0x7f6fc3688004 content::RenderViewHostImpl::CreateRenderView()
#6 0x7f6fc376c4b2 content::WebContentsImpl::CreateRenderViewForRenderManager()
#7 0x7f6fc3531b5d content::RenderFrameHostManager::ReinitializeRenderFrame()
#8 0x7f6fc3531247 content::RenderFrameHostManager::Navigate()
#9 0x7f6fc3510e15 content::NavigatorImpl::NavigateToEntry()
#10 0x7f6fc35117b5 content::NavigatorImpl::NavigateToPendingEntry()
#11 0x7f6fc3501eb7 content::NavigationControllerImpl::NavigateToPendingEntryInternal()
#12 0x7f6fc34fe0f2 content::NavigationControllerImpl::NavigateToPendingEntry()
#13 0x7f6fc34fedc4 content::NavigationControllerImpl::LoadURLWithParams()
#14 0x7f6fc6d293a8 headless::HeadlessWebContentsImpl::Create()
#15 0x7f6fc6d2c134 headless::HeadlessBrowserContextImpl::CreateWebContents()
#16 0x7f6fc428a40a headless::HeadlessShell::OnStart()
#17 0x7f6fc6d2d862 headless::HeadlessBrowserImpl::RunOnStartCallback()
#18 0x7f6fc7f807b1 headless::HeadlessContentMainDelegate::RunProcess()
#19 0x7f6fc4287ec7 content::RunNamedProcessTypeMain()
#20 0x7f6fc42887fd content::ContentMainRunnerImpl::Run()
#21 0x7f6fc4290314 service_manager::Main()
#22 0x7f6fc4287462 content::ContentMain()
#23 0x7f6fc6d2e325 headless::(anonymous namespace)::RunContentMain()
#24 0x7f6fc6d2e39c headless::HeadlessBrowserMain()
#25 0x7f6fc428e0e2 headless::HeadlessShellMain()
#26 0x7f6fc2ec7b6d ChromeMain
#27 0x7f6fbbc49b35 __libc_start_main
#28 0x7f6fc2ec79d0

Received signal 6
#0 0x7f6fc457d657 base::debug::StackTrace::StackTrace()
#1 0x7f6fc457d1cf base::debug::(anonymous namespace)::StackDumpSignalHandler()
#2 0x7f6fc1ef4370
#3 0x7f6fbbc5d1d7 __GI_raise
#4 0x7f6fbbc5e8c8 __GI_abort
#5 0x7f6fc457c202 base::debug::BreakDebugger()
#6 0x7f6fc45917cc logging::LogMessage::~LogMessage()
#7 0x7f6fc4aad472 gfx::PlatformFontLinux::PlatformFontLinux()
#8 0x7f6fc4aae436 gfx::PlatformFont::CreateDefault()
#9 0x7f6fc4aa68c9 gfx::Font::Font()
#10 0x7f6fc3688004 content::RenderViewHostImpl::CreateRenderView()
#11 0x7f6fc376c4b2 content::WebContentsImpl::CreateRenderViewForRenderManager()
#12 0x7f6fc3531b5d content::RenderFrameHostManager::ReinitializeRenderFrame()
#13 0x7f6fc3531247 content::RenderFrameHostManager::Navigate()
#14 0x7f6fc3510e15 content::NavigatorImpl::NavigateToEntry()
#15 0x7f6fc35117b5 content::NavigatorImpl::NavigateToPendingEntry()
#16 0x7f6fc3501eb7 content::NavigationControllerImpl::NavigateToPendingEntryInternal()
#17 0x7f6fc34fe0f2 content::NavigationControllerImpl::NavigateToPendingEntry()
#18 0x7f6fc34fedc4 content::NavigationControllerImpl::LoadURLWithParams()
#19 0x7f6fc6d293a8 headless::HeadlessWebContentsImpl::Create()
#20 0x7f6fc6d2c134 headless::HeadlessBrowserContextImpl::CreateWebContents()
#21 0x7f6fc428a40a headless::HeadlessShell::OnStart()
#22 0x7f6fc6d2d862 headless::HeadlessBrowserImpl::RunOnStartCallback()
#23 0x7f6fc7f807b1 headless::HeadlessContentMainDelegate::RunProcess()
#24 0x7f6fc4287ec7 content::RunNamedProcessTypeMain()
#25 0x7f6fc42887fd content::ContentMainRunnerImpl::Run()
#26 0x7f6fc4290314 service_manager::Main()
#27 0x7f6fc4287462 content::ContentMain()
#28 0x7f6fc6d2e325 headless::(anonymous namespace)::RunContentMain()
#29 0x7f6fc6d2e39c headless::HeadlessBrowserMain()
#30 0x7f6fc428e0e2 headless::HeadlessShellMain()
#31 0x7f6fc2ec7b6d ChromeMain
#32 0x7f6fbbc49b35 __libc_start_main
#33 0x7f6fc2ec79d0
r8: 00007ffd2a1a1030 r9: 0000000000000000 r10: 0000000000000008 r11: 0000000000000202
r12: 00007ffd2a1a1090 r13: 0000000000000076 r14: 00007ffd2a1a1088 r15: 00007ffd2a1a1080
di: 0000000000006e38 si: 0000000000006e38 bp: 00007ffd2a1a0c40 bx: 00007ffd2a1a0c40
dx: 0000000000000006 ax: 0000000000000000 cx: ffffffffffffffff sp: 00007ffd2a1a0a98
ip: 00007f6fbbc5d1d7 efl: 0000000000000202 cgf: 0000000000000033 erf: 0000000000000000
trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
Calling _exit(1). Core file will not be generated.
(node:28112) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: socket hang up
[0100/000000.311368:ERROR:broker_posix.cc(43)] Invalid node channel message

@paambaati
Copy link

@paambaati paambaati commented Aug 20, 2017

Check failed: InitDefaultFont(). Could not find the default font

@rlog Looks like a missing dependency. Are you sure you've installed all the dependencies listed here?

@rlog
Copy link
Author

@rlog rlog commented Aug 20, 2017

@paambaati I'm trying to install all this dependencies on centos 7, but nothing new install:

robin@eve ~ $ sudo yum 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
[sudo] password for robin:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
No package gconf-service available.
No package libasound2 available.
No package libatk1.0-0 available.
No package libc6 available.
No package libcairo2 available.
No package libcups2 available.
No package libdbus-1-3 available.
No package libexpat1 available.
No package libfontconfig1 available.
No package libgcc1 available.
No package libgconf-2-4 available.
No package libgdk-pixbuf2.0-0 available.
No package libglib2.0-0 available.
No package libgtk-3-0 available.
No package libnspr4 available.
No package libpango-1.0-0 available.
No package libpangocairo-1.0-0 available.
No package libstdc++6 available.
No package libx11-6 available.
No package libx11-xcb1 available.
No package libxcb1 available.
No package libxcomposite1 available.
No package libxcursor1 available.
No package libxdamage1 available.
No package libxext6 available.
No package libxfixes3 available.
No package libxi6 available.
No package libxrandr2 available.
No package libxrender1 available.
No package libxss1 available.
No package libxtst6 available.
Package ca-certificates-2017.2.14-70.1.el7_3.noarch already installed and latest version
No package fonts-liberation available.
No package libappindicator1 available.
No package libnss3 available.
No package lsb-release available.
Package xdg-utils-1.1.0-0.17.20120809git.el7.noarch already installed and latest version
Package wget-1.14-13.el7.x86_64 already installed and latest version
Nothing to do

@Garbee
Copy link
Contributor

@Garbee Garbee commented Aug 21, 2017

You need to convert the package names to be RHEL names. Those are only the Debian names.

@rlog
Copy link
Author

@rlog rlog commented Aug 21, 2017

@Garbee I don't know how to convert, google them one by one ...?

@Garbee
Copy link
Contributor

@Garbee Garbee commented Aug 21, 2017

That or grab an RPM copy of the installer and use software management tools to look at what the dependencies of the package are.

@theoutlander
Copy link

@theoutlander theoutlander commented Aug 23, 2017

Having a similar issue. Here's what I discovered:

[root@li583-175 chrome-linux]# ldd chrome | more
linux-vdso.so.1 => (0x00007ffcd3ee4000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f55baf90000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f55bad8c000)
librt.so.1 => /lib64/librt.so.1 (0x00007f55bab83000)
libpangocairo-1.0.so.0 => not found
libpango-1.0.so.0 => not found
libcairo.so.2 => not found
libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x00007f55ba932000)
libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007f55ba5fb000)
libX11.so.6 => /lib64/libX11.so.6 (0x00007f55ba2bc000)
libX11-xcb.so.1 => /lib64/libX11-xcb.so.1 (0x00007f55ba0ba000)
libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f55b9e98000)
libXcomposite.so.1 => not found
libXcursor.so.1 => not found
libXdamage.so.1 => not found
libXext.so.6 => not found
libXfixes.so.3 => not found
libXi.so.6 => not found
libXrender.so.1 => not found
libXtst.so.6 => not found
libgmodule-2.0.so.0 => /lib64/libgmodule-2.0.so.0 (0x00007f55b9c91000)
libnss3.so => /lib64/libnss3.so (0x00007f55b9966000)
libnssutil3.so => /lib64/libnssutil3.so (0x00007f55b9739000)
libsmime3.so => /lib64/libsmime3.so (0x00007f55b9512000)
libnspr4.so => /lib64/libnspr4.so (0x00007f55b92d3000)
libcups.so.2 => not found
libexpat.so.1 => /lib64/libexpat.so.1 (0x00007f55b90a9000)
libfontconfig.so.1 => /lib64/libfontconfig.so.1 (0x00007f55b8e6b000)
libdbus-1.so.3 => /lib64/libdbus-1.so.3 (0x00007f55b8c23000)
libXss.so.1 => not found
libXrandr.so.2 => not found
libgconf-2.so.4 => not found
libgio-2.0.so.0 => /lib64/libgio-2.0.so.0 (0x00007f55b88a2000)
libasound.so.2 => /lib64/libasound.so.2 (0x00007f55b85a9000)
libm.so.6 => /lib64/libm.so.6 (0x00007f55b82a7000)
libatk-1.0.so.0 => not found
libgtk-3.so.0 => not found
libgdk-3.so.0 => not found
libgdk_pixbuf-2.0.so.0 => not found
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f55b808f000)
libc.so.6 => /lib64/libc.so.6 (0x00007f55b7cce000)
/lib64/ld-linux-x86-64.so.2 (0x000055a8c8793000)
libffi.so.6 => /lib64/libffi.so.6 (0x00007f55b7ac6000)
libXau.so.6 => /lib64/libXau.so.6 (0x00007f55b78c1000)
libplc4.so => /lib64/libplc4.so (0x00007f55b76bc000)
libplds4.so => /lib64/libplds4.so (0x00007f55b74b8000)
libfreetype.so.6 => /lib64/libfreetype.so.6 (0x00007f55b7211000)
libz.so.1 => /lib64/libz.so.1 (0x00007f55b6ffb000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f55b6dd3000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f55b6bb9000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f55b6957000)

I had installed one of the missing packages manually, but it still doesn't find it. I can see that particular package under /usr/lib/libpangocairo-1.0.so.0.

@historylife
Copy link

@historylife historylife commented Aug 24, 2017

So bottom of line , puppeteer can not work on centos !

@theoutlander
Copy link

@theoutlander theoutlander commented Aug 24, 2017

Here's another issue I'm running into when trying on Docker Centos7:

[root@3dd3c09a9d40 opt]# npm install -g puppeteer

puppeteer@0.9.0 install /usr/lib/node_modules/puppeteer
node install.js

Download failed: EACCES: permission denied, mkdir '/usr/lib/node_modules/puppeteer/.local-chromium'

  • puppeteer@0.9.0
    added 36 packages in 2.437s

I'm running as root. Not sure if that's the issue. I've changed ownership on that folder path. Even tried to create that folder manually and tried with sudo, yet I get that same error repeatedly.

@liulangyu90316
Copy link

@liulangyu90316 liulangyu90316 commented Aug 24, 2017

@rlog try install fonts?

yum install ipa-gothic-fonts xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc -y

@theoutlander
Copy link

@theoutlander theoutlander commented Aug 24, 2017

Tried it in Ubuntu on Docker and got a similar message:

root@6c5ca63ee50a:/opt/node_modules/puppeteer/.local-chromium/linux-494755/chrome-linux# ./chrome
./chrome: error while loading shared libraries: libpangocairo-1.0.so.0: cannot open shared object file: No such file or directory

root@6c5ca63ee50a:/opt/node_modules/puppeteer/.local-chromium/linux-494755/chrome-linux# ldd ./chrome
linux-vdso.so.1 => (0x00007fffd9a6f000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f74809c4000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f74807c0000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f74805b8000)
libpangocairo-1.0.so.0 => not found
libpango-1.0.so.0 => not found
libcairo.so.2 => not found
libgobject-2.0.so.0 => not found
libglib-2.0.so.0 => not found
libX11.so.6 => not found
libX11-xcb.so.1 => not found
libxcb.so.1 => not found
libXcomposite.so.1 => not found
libXcursor.so.1 => not found
libXdamage.so.1 => not found
libXext.so.6 => not found
libXfixes.so.3 => not found
libXi.so.6 => not found
libXrender.so.1 => not found
libXtst.so.6 => not found
libgmodule-2.0.so.0 => not found
libnss3.so => not found
libnssutil3.so => not found
libsmime3.so => not found
libnspr4.so => not found
libcups.so.2 => not found
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f748038f000)
libfontconfig.so.1 => not found
libdbus-1.so.3 => not found
libXss.so.1 => not found
libXrandr.so.2 => not found
libgconf-2.so.4 => not found
libgio-2.0.so.0 => not found
libasound.so.2 => not found
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7480086000)
libatk-1.0.so.0 => not found
libgtk-3.so.0 => not found
libgdk-3.so.0 => not found
libgdk_pixbuf-2.0.so.0 => not found
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f747fe70000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f747faa6000)
/lib64/ld-linux-x86-64.so.2 (0x00007f74887de000)
root@6c5ca63ee50a:/opt/node_modules/puppeteer/.local-chromium/linux-494755/chrome-linux#

@historylife
Copy link

@historylife historylife commented Aug 24, 2017

I am using centos 6.9 , is there any step by step guide to install "puppeteer" on ?

node : v8.4.0
npm : 5.3.0
uname -a
Linux server 2.6.32-673.26.1.lve1.4.24.el6.x86_64 #1 SMP Wed Mar 29 17:09:57 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux
@theoutlander
Copy link

@theoutlander theoutlander commented Aug 24, 2017

The best solution at this point is to use Ubuntu and follow these instructions #290 (comment).

I started development on OSX and didn't realize about this issue until we decided to go into production 😮.

@Garbee
Copy link
Contributor

@Garbee Garbee commented Aug 24, 2017

@theoutlander Why install puppeteer globally in the first place? When installing globally and you're going into a non-user folder (as you are) you need to run as root. Hence why it is not recommended.

@theoutlander
Copy link

@theoutlander theoutlander commented Aug 24, 2017

@Garbee you're right! I was running into other installation issues and overlooked that I was installing globally. (I recall seeing it, but was thinking I need to install it globally)

@historylife
Copy link

@historylife historylife commented Aug 24, 2017

@Garbee kindly may you advice step by step for centos 6.X , i am very confused how to install ...

@Garbee
Copy link
Contributor

@Garbee Garbee commented Aug 25, 2017

@historylife Upgrade to CentOS 7. 6 is no longer supported.

@historylife
Copy link

@historylife historylife commented Aug 26, 2017

@Garbee i dont follow you , do you advise me to upgrade to CentOS 7. 6

@zhuyingda
Copy link

@zhuyingda zhuyingda commented Aug 27, 2017

@liulangyu90316 I have the same problem, centos7.3, I installed all the dependency but got socket hang up, and I can run ./chrome -v --no-sandbox --disable-setuid-sandbox but can not run puppeteer. After install your font dependency, everything got right. Thank you!

@rlog
Copy link
Author

@rlog rlog commented Aug 28, 2017

which OS is recommend? I can change my OS (except macOS and Windows)

@zhuyingda
Copy link

@zhuyingda zhuyingda commented Aug 28, 2017

@rlog you can take centos 7.3, same with me, and see this

@SeanSanker
Copy link

@SeanSanker SeanSanker commented Aug 28, 2017

@zhuyingda 's notes above will allow you to run puppeteer with --no-sandbox, but this is insecure as the sandbox is intended to isolate the process from the system.

The error message itself ('No usable sandbox!'), states If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox..

Running without a sandbox should be considered bad practice and potentially harmful.

Then again, if it works, it works.

In recap:
Install the deps by running:
yum install pango.x86_64 libXcomposite.x86_64 libXcursor.x86_64 libXdamage.x86_64 libXext.x86_64 libXi.x86_64 libXtst.x86_64 cups-libs.x86_64 libXScrnSaver.x86_64 libXrandr.x86_64 GConf2.x86_64 alsa-lib.x86_64 atk.x86_64 gtk3.x86_64 ipa-gothic-fonts xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc -y
... and in the source file, when you launch the browser itself specify:
const browser = await puppeteer.launch({ args: ['--no-sandbox']})

With that you'll be good to go (or should hopefully be), but it's playing a risky game, especially if this is a production system.

(Out of curiosity I checked, and thankfully; you can't run chrome --no-sandbox as root. ref. Running as root without --no-sandbox is not supported. See https://crbug.com/638180)

@SeanSanker
Copy link

@SeanSanker SeanSanker commented Aug 28, 2017

If you're a lunatic you can spend a few days trying to compile chromium from source, then compile the sandbox from source, and attempt to monkey-patch them together.
Build Chromium
Build Sandbox

Although if you look at the top of the Build Sandbox link, it appears they'll be dumping support for the SUID sandbox in favor User namespaces sandbox (sandbox list). Here's the thing, it looks like the chromium issue for replacing SUID has been open since 2013 so I wouldn't bank on that fixing this.

@JustinYi922
Copy link

@JustinYi922 JustinYi922 commented Aug 29, 2017

I have the same problem,too。

node:v8.4.0
centos:centos-release-7-2.1511.el7.centos.2.10.x86_64

(node:21521) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed to connect to chrome!
(node:21521) [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.

@zhuyingda
Copy link

@zhuyingda zhuyingda commented Aug 29, 2017

@JustinYi922 You can try the font requirements which I mentioned

@AJLoveChina
Copy link

@AJLoveChina AJLoveChina commented Apr 18, 2019

English:
If you have installed all the dependencies for centos,
But it is still not working!!!
Using Docker instead.

中文:
如果你全部的依赖都安装了,但是pptr依然无法运行,尝试使用Docker吧!
我在知乎写了一篇文章,也推荐给大家。
Linux下如何运行puppeteer? puppeteer搭配Docker光速部署的正确姿势

Tip:请不要害怕Docker,它非常简单好用方便安装。

建议:如果你的程序不是部署在产线环境,我非常建议你使用Docker来部署pptr开发的应用。而且大部分情况pptr开发的应用都是在dev环境运行的,无需部署到产线环境。

@zhangzippo
Copy link

@zhangzippo zhangzippo commented Apr 20, 2019

I have installed all the dependencies for centos, but it show , how to solve it?

./chrome --headless
./chrome: symbol lookup error: /usr/lib64/firefox/bundled/lib64/libcairo-gobject.so.2: undefined symbol: cairo_region_destroy

@frojan
Copy link

@frojan frojan commented May 24, 2019

@matrey Worked for me in CentOS Linux release 7.5.1804 (Core) . Thanks. :)

@fiany
Copy link

@fiany fiany commented Jul 3, 2019

我将这一句注释掉就可以了 // headless: false,
centos7正常打包

@steve-powers
Copy link

@steve-powers steve-powers commented Jul 24, 2019

I tried the yum install of all the dependencies mentioned in the troubleshooting doc and in this forum, and atk and gtk3 are no longer available. I had to find them elsewhere using rpm, so making use of puppeteer in production systems seems to be difficult. Is there anyway to resolve dependencies through package.json npm, I do not want to make customers do major installs to use a reports system as I try to replace phantomjs.

@theaspect
Copy link

@theaspect theaspect commented Jul 24, 2019

@agamemnus
Copy link

@agamemnus agamemnus commented Jul 24, 2019

Seems so convoluted. I hope you can get it working on CentOS 7. I managed to do it a month or so back. Actually had to switch servers and upgrade from CentOS 6 to run Puppeteer.

@steve-powers
Copy link

@steve-powers steve-powers commented Jul 24, 2019

I have been trying to get non-docker centos7 puppeteer working and originally was running a big series of yum+rpm I found, which I complained about here. But combing through again I was able to use the solution last appended by jjejj on Mar 12, so edited this append.
Though cleaner with just yum, installing 21 libraries seems painful, if anyone figures out a LD_LIBRARY_PATH solution please append. I also appreciate the docker suggestion, I went down that path and did get things working well, but can't get the installer updated in time. Maybe next release :)

@konradsoares
Copy link

@konradsoares konradsoares commented Aug 1, 2019

Try sudo yum install -y chromium then run npm I again and run your app.

@Sanjay007
Copy link

@Sanjay007 Sanjay007 commented Feb 20, 2020

Hope this helps for you , it resolved my issue.
Pupeteer Sandbox Issue resolved

@dengnan123
Copy link

@dengnan123 dengnan123 commented Mar 9, 2020

@zhuyingda 's notes above will allow you to run puppeteer with --no-sandbox, but this is insecure as the sandbox is intended to isolate the process from the system.

The error message itself ('No usable sandbox!'), states If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox..

Running without a sandbox should be considered bad practice and potentially harmful.

Then again, if it works, it works.

In recap:
Install the deps by running:
yum install pango.x86_64 libXcomposite.x86_64 libXcursor.x86_64 libXdamage.x86_64 libXext.x86_64 libXi.x86_64 libXtst.x86_64 cups-libs.x86_64 libXScrnSaver.x86_64 libXrandr.x86_64 GConf2.x86_64 alsa-lib.x86_64 atk.x86_64 gtk3.x86_64 ipa-gothic-fonts xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc -y
... and in the source file, when you launch the browser itself specify:
const browser = await puppeteer.launch({ args: ['--no-sandbox']})

With that you'll be good to go (or should hopefully be), but it's playing a risky game, especially if this is a production system.

(Out of curiosity I checked, and thankfully; you can't run chrome --no-sandbox as root. ref. Running as root without --no-sandbox is not supported. See https://crbug.com/638180)

thanks !

@flexjoly
Copy link

@flexjoly flexjoly commented Apr 15, 2020

Thanks @Sanjay007 !!

Hope this helps for you , it resolved my issue.
Pupeteer Sandbox Issue resolved

This solved my problem with the sandbox too!

#as root
cd /path-to/node_modules/puppeteer/.local-chromium/linux-XXXX/chrome-linux/
mv chrome_sandbox chrome-sandbox
chown root chrome-sandbox
chmod 4755 chrome-sandbox

Please update the docs on the sandbox for the current advise is not working at all in Centos7.

@jayai2014
Copy link

@jayai2014 jayai2014 commented Jul 15, 2020

@

Thanks @Sanjay007 !!

Hope this helps for you , it resolved my issue.
Pupeteer Sandbox Issue resolved

This solved my problem with the sandbox too!

#as root
cd /path-to/node_modules/puppeteer/.local-chromium/linux-XXXX/chrome-linux/
mv chrome_sandbox chrome-sandbox
chown root chrome-sandbox
chmod 4755 chrome-sandbox

Please update the docs on the sandbox for the current advise is not working at all in Centos7.

Thanks god your fix work on my env, i'm on centos 7.8 using taiko

@json-Li
Copy link

@json-Li json-Li commented Jul 30, 2020

I have installed all the dependencies for centos, but it show , how to solve it?

./chrome --headless
./chrome: symbol lookup error: /usr/lib64/firefox/bundled/lib64/libcairo-gobject.so.2: undefined symbol: cairo_region_destroy

have you solved this problem? i faced this issue too

@heathdutton
Copy link

@heathdutton heathdutton commented Jul 30, 2020

In our case (Amazon Linux 2) we fixed it by:

yum install -y alsa-lib.x86_64 \
atk.x86_64 \
cups-libs.x86_64 \
gtk3.x86_64 \
ipa-gothic-fonts \
libXcomposite.x86_64 \
libXcursor.x86_64 \
libXdamage.x86_64 \
libXext.x86_64 \
libXi.x86_64 \
libXrandr.x86_64 \
libXScrnSaver.x86_64 \
libXtst.x86_64 \
pango.x86_64 \
xorg-x11-fonts-100dpi \
xorg-x11-fonts-75dpi \
xorg-x11-fonts-cyrillic \
xorg-x11-fonts-misc \
xorg-x11-fonts-Type1 \
xorg-x11-utils
yum update nss -y

As explained in the docs: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix
We also scaled up to slightly more ram when it hung after doing the above.

Hope that helps someone.

@rinogo
Copy link

@rinogo rinogo commented Aug 13, 2020

On a barebones install of CentOS 7 (on Amazon AWS EC2), I was able to get chrome headless running with the following:
sudo yum install atk java-atk-wrapper at-spi2-atk gtk3 libXt

@yortch
Copy link

@yortch yortch commented May 10, 2021

For anybody trying to get puppeteer to work on a ubi8 image, this exact combination of dependencies worked for me:

FROM registry.access.redhat.com/ubi8/nodejs-12:latest
USER root
RUN yum install -y alsa-lib.x86_64 atk.x86_64 cups-libs.x86_64 gtk3.x86_64 \
    libXcomposite.x86_64 libXcursor.x86_64 libXdamage.x86_64 \
    libXext.x86_64 libXi.x86_64 libXrandr.x86_64 libXScrnSaver.x86_64 \
    libXtst.x86_64 pango.x86_64 xorg-x11-fonts-Type1 libdrm-2.4.101-1.el8.x86_64 \
    mesa-libgbm-20.1.4-1.el8.x86_64 libxshmfence-1.3-2.el8.x86_64 nss.i686 \
    && yum update -y && yum clean all 
USER 1001 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet