gpt4 book ai didi

javascript - prerender-spa-plugin 在服务器上不工作

转载 作者:搜寻专家 更新时间:2023-10-30 22:26:41 25 4
gpt4 key购买 nike

我正在尝试在服务器上运行构建。但是使用预渲染,会出现以下错误。在桌面版的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,
}),
})

最佳答案

我有同样的问题,它在本地完美运行,但问题出现在服务器上。我的临时修复是减少在

routes: []
上传递的路由数量

关于javascript - prerender-spa-plugin 在服务器上不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50741337/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com