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

unable to start Puppeteer. Failed to launch chrome #200

Closed
484sha opened this Issue May 22, 2018 · 33 comments

Comments

Projects
None yet
8 participants
@484sha
Copy link

484sha commented May 22, 2018

I have a problem in starting prerender-spa-plugin in linux.Can you help me?
n7yp vc9w hfm_b96urp n

@Tribex

This comment has been minimized.

Copy link
Collaborator

Tribex commented May 22, 2018

@484sha Looks like you're running Puppeteer with a headless system. You'll need to follow these guidelines to properly configure your server: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

@Tribex Tribex closed this May 22, 2018

@484sha

This comment has been minimized.

Copy link

484sha commented May 23, 2018

Thank you for your reply. But I don't use Puppeteer directly. I don't know where to add "const browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});" in my project. Is in webpack.prod.conf.js?

@Tribex

This comment has been minimized.

Copy link
Collaborator

Tribex commented May 23, 2018

@484sha That matter is handled internally by prerenderer. You shouldn't need to change your options unless you're using headless: false (Remove this if you have it.)

What are the details of the system you're using?

@484sha

This comment has been minimized.

Copy link

484sha commented May 23, 2018

I use prerender-spa-plugin in webpack.prod.conf.js like this:
new PrerenderSPAPlugin({
staticDir: path.join(__dirname, '../dist'),
routes: ['/home'],
renderer: new Renderer({
inject: {
foo: 'bar'
},
headless: false,
renderAfterTime: 5000
})
})
Should I remove "headless: false" ? My system is centos 7.3 x86_64.

@484sha

This comment has been minimized.

Copy link

484sha commented May 23, 2018

Thanks a lot. I have built my project successfully after remove "headless: false".

@jpcmf

This comment has been minimized.

Copy link

jpcmf commented Aug 15, 2018

I getting the same error. Remove headless: false and the error persist. Any advice? I'm running Vue CLI with Webpack.

@Tribex

This comment has been minimized.

Copy link
Collaborator

Tribex commented Aug 15, 2018

@jpcmf Is the error "Cannot open display?"

@jpcmf

This comment has been minimized.

Copy link

jpcmf commented Aug 15, 2018

@Tribex This is the error

[Prerenderer - PuppeteerRenderer] Unable to start Puppeteer
(node:1988) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Cannot read property 'close' of null
(node:1988) [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.
@jpcmf

This comment has been minimized.

Copy link

jpcmf commented Aug 15, 2018

@Tribex Any help?

@Tribex

This comment has been minimized.

Copy link
Collaborator

Tribex commented Aug 15, 2018

@484sha

This comment has been minimized.

Copy link

484sha commented Aug 27, 2018

@jpcmf If you use prerender-spa-plugin in linux, you should remove inject and headless. It works fine for me.

@jpcmf

This comment has been minimized.

Copy link

jpcmf commented Aug 27, 2018

@484sha I'm running osx :/

@484sha

This comment has been minimized.

Copy link

484sha commented Aug 27, 2018

@jpcmf Sorry, I don`t have an osx system, so I can't verify if it works on osx.

@SHERlocked93

This comment has been minimized.

Copy link

SHERlocked93 commented Sep 5, 2018

@jpcmf This works for me can not launch

@jpcmf

This comment has been minimized.

Copy link

jpcmf commented Sep 5, 2018

@SHERlocked93 I will check later, thank you 👍

@melkishengue

This comment has been minimized.

Copy link

melkishengue commented Sep 16, 2018

I am currently facing a similar issue on debian 7 using webpack and vue.js. I am instantiating the plugin like this in the webpack config file:

const PuppeteerRenderer = PrerenderSPAPlugin.PuppeteerRenderer;

And in the plugins array:

new PrerenderSPAPlugin({ staticDir: join(__dirname, 'dist'), routes: ['/', '/login'], renderer: new PuppeteerRenderer() })

This gives me the error:

Error: Failed to launch chrome! spawn frontend/node_modules/puppeteer/.local-chromium/linux-588429/chrome-linux/chrome ENOENT

(node:2897) 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: 26) (node:2897) [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.

@Tribex

This comment has been minimized.

Copy link
Collaborator

Tribex commented Sep 16, 2018

@melkishengue Looks like puppeteer didn't install properly for you. Try running npm install or npm rebuild again.

@melkishengue

This comment has been minimized.

Copy link

melkishengue commented Sep 16, 2018

I ran both commands, but still getting the same error.

@Tribex

This comment has been minimized.

Copy link
Collaborator

Tribex commented Sep 16, 2018

@melkishengue Is there anything in this directory? frontend/node_modules/puppeteer/.local-chromium/linux-588429/chrome-linux/

@melkishengue

This comment has been minimized.

Copy link

melkishengue commented Sep 16, 2018

yes I just checked it, there are files there, and also a file named chrome there

@melkishengue

This comment has been minimized.

Copy link

melkishengue commented Sep 16, 2018

bildschirmfoto 2018-09-17 um 00 35 39

@Tribex

This comment has been minimized.

Copy link
Collaborator

Tribex commented Sep 16, 2018

What happens when you try to run it?

@melkishengue

This comment has been minimized.

Copy link

melkishengue commented Sep 16, 2018

Unfortunately getting the same error

bildschirmfoto 2018-09-17 um 00 51 51

@Tribex

This comment has been minimized.

Copy link
Collaborator

Tribex commented Sep 16, 2018

@melkishengue I mean run chrome directly from that folder. (ie with ./chrome --no-sandbox)
If everything is in place properly, it should start right up.

@melkishengue

This comment has been minimized.

Copy link

melkishengue commented Sep 17, 2018

@Tribex Somehow the file can't be ran from within the folder, although the file is present. It gives me "unable to execute ./chrome: No such file or directory" as result to this command... I checked permissions, even tried to run it with sudo, nothing helped...

@arunkp

This comment has been minimized.

Copy link

arunkp commented Nov 27, 2018

@melkishengue Did you solve the issue? I'm facing the same issue...

@jinggoing

This comment has been minimized.

Copy link

jinggoing commented Dec 7, 2018

2018-12-07 18:05:28,624 ERROR 15478 nodejs.unhandledRejectionError: Failed to launch chrome!
/usr/local/nginx/works_list/screenShootService/node_modules/puppeteer/.local-chromium/linux-609904/chrome-linux/chrome: error while loading shared libraries: libXcomposite.so.1: cannot open shared object file: No such file or directory

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

/usr/local/nginx/works_list/screenShootService/node_modules/puppeteer/.local-chromium/linux-609904/chrome-linux/chrome: error while loading shared libraries: libXcomposite.so.1: cannot open shared object file: No such file or directory

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

at onClose (/usr/local/nginx/works_list/screenShootService/node_modules/puppeteer/lib/Launcher.js:342:14)
at Interface.helper.addEventListener (/usr/local/nginx/works_list/screenShootService/node_modules/puppeteer/lib/Launcher.js:331:50)
at Interface.emit (events.js:187:15)
at Interface.close (readline.js:379:8)
at Socket.onend (readline.js:157:10)
at Socket.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1092:12)
at process._tickCallback (internal/process/next_tick.js:63:19)

name: "unhandledRejectionError"

os: centos
how can i fix it.

@Tribex

This comment has been minimized.

Copy link
Collaborator

Tribex commented Dec 10, 2018

@jinggoing Sounds like you have a number of missing dependencies, see here: GoogleChrome/puppeteer#391 (comment)

@jinggoing

This comment has been minimized.

Copy link

jinggoing commented Dec 10, 2018

i downloaded the dependencies, but report another error:

2018-12-10 10:11:42,896 ERROR 27159 nodejs.unhandledRejectionError: Failed to launch chrome!
/usr/local/nginx/works_list/screenShootService/node_modules/puppeteer/.local-chromium/linux-609904/chrome-linux/chrome: symbol lookup error: /lib64/libpango-1.0.so.0: undefined symbol: g_log_structured_standard

@Tribex

This comment has been minimized.

Copy link
Collaborator

Tribex commented Dec 10, 2018

@jinggoing Sounds like a puppeteer issue. I'd recommend asking on the puppeteer repository: https://github.com/GoogleChrome/puppeteer/issues

@BruneXX

This comment has been minimized.

Copy link

BruneXX commented Dec 11, 2018

@Tribex @jinggoing @melkishengue I'm facing exactly the same error, Is there no solution for this?

 98% after emitting PrerenderSPAPluginError: Failed to launch chrome!
/ng-app/node_modules/puppeteer/.local-chromium/linux-609904/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory


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

    at onClose (/ng-app/node_modules/puppeteer/lib/Launcher.js:342:14)
    at Interface.helper.addEventListener (/ng-app/node_modules/puppeteer/lib/Launcher.js:331:50)

...

Prerenderer - PuppeteerRenderer] Unable to start Puppeteer
(node:120) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'close' of null
@BruneXX

This comment has been minimized.

Copy link

BruneXX commented Dec 11, 2018

@Tribex @jinggoing @melkishengue Found a solution! I'm using linux and I've missing dependencies, following: TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

"Chrome headless doesn't launch"

Was the solution for me, now I'm facing this: #181

@arunkp

This comment has been minimized.

Copy link

arunkp commented Dec 12, 2018

The solution for me was to update my pupeeteer npm package.
Also do this if you are on ubuntu:
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment