无法在Google Cloud Build中运行spa-prerender

时间:2019-07-18 05:42:27

标签: google-cloud-platform puppeteer prerender

我正在尝试使用prerender-spa-plugin在Google Build中预渲染某些Vue.js应用程序(来自GKP),并且我的构建脚本在使用puppeteer启动无头Chrome浏览器时遇到了问题。

文档here中的10 我在控制台中遇到错误:

The Node.js runtime of the App Engine standard environment comes with all system packages needed to run Headless Chrome.

在本地环境中,一切都可以正常工作。 我还尝试只运行仅运行puppeteer的脚本:

Step #2: Error: Failed to launch chrome!
Step #2: /workspace/node_modules/puppeteer/.local-chromium/linux-672088/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory
Step #2: 
Step #2: 
Step #2: TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

它也失败了。

这是我的cloudbuild.yml配置

const puppeteer = require('puppeteer');

async function startPuppeteer() {
    const browser = await puppeteer.launch({
        args: ['--no-sandbox'],
    });

    console.log('browser started!!!');
}


startPuppeteer();

steps: - name: node:8.14.1 entrypoint: npm args: ['install'] - name: node:8.14.1 entrypoint: npm args: ['run', 'prerender'] 脚本中,我只运行了启用了prerender插件的webpack。 但是问题在于在Google Cloud中运行puppeteer,所以我不会附加任何webpack配置,我认为这毫无意义

0 个答案:

没有答案