【发布时间】:2018-11-17 09:00:27
【问题描述】:
我正在尝试在服务器上运行构建。但是通过预渲染,会出现以下错误。在 ubuntu 和 macOS 的桌面版本上,没有这个问题,问题只是服务器端。我在不同的服务器上试过。
95% emittingError: Failed to launch chrome!
TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
at onClose (/home/phpuser/testPrerender/frontend/node_modules/puppeteer/lib/Launcher.js:255:14)
at ChildProcess.helper.addEventListener (/home/phpuser/testPrerender/frontend/node_modules/puppeteer/lib/Launcher.js:245:60)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:194:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
[Prerenderer - PuppeteerRenderer] Unable to start Puppeteer
(node:2535) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'close' of null
(node:2535) 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.
我在 webpack 中的 prerender-spa-plugin 设置:
new PrerenderSPAPlugin({
// Required - The path to the webpack-outputted app to prerender.
staticDir: _.outputPath,
// Required - Routes to render.
routes: ['/', '/abouts', '/mobile-apps', '/docs/service-fees', '/news', '/legal/Terms%20of%20use', '/legal/Refund%20policy', '/legal/Privacy%20Policy', '/legal/Notification%20o$
renderer: new PrerenderSPAPlugin.PuppeteerRenderer({
renderAfterDocumentEvent: 'render-event',
headless: false,
}),
})
【问题讨论】:
标签: javascript webpack vue.js url-routing single-page-application