Google cloud platform 无法在Google Cloud Build中运行spa prerender
我正试图在Google Build(来自GKP)中使用预渲染一些Vue.js应用程序,我的构建脚本在使用Puppeter启动无头Chrome浏览器时遇到问题 文档中指出,App Engine标准环境的Node.js运行时附带了运行Headless Chrome所需的所有系统包。 控制台中出现错误:Google cloud platform 无法在Google Cloud Build中运行spa prerender,google-cloud-platform,puppeteer,prerender,Google Cloud Platform,Puppeteer,Prerender,我正试图在Google Build(来自GKP)中使用预渲染一些Vue.js应用程序,我的构建脚本在使用Puppeter启动无头Chrome浏览器时遇到问题 文档中指出,App Engine标准环境的Node.js运行时附带了运行Headless Chrome所需的所有系统包。 控制台中出现错误: Step #2: Error: Failed to launch chrome! Step #2: /workspace/node_modules/puppeteer/.local-chromium/
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
在当地环境中,Everythink工作正常。
我还试着只运行脚本运行木偶演员:
const puppeteer = require('puppeteer');
async function startPuppeteer() {
const browser = await puppeteer.launch({
args: ['--no-sandbox'],
});
console.log('browser started!!!');
}
startPuppeteer();
它也失败了
这是我的cloudbuild.yml配置
steps:
- name: node:8.14.1
entrypoint: npm
args: ['install']
- name: node:8.14.1
entrypoint: npm
args: ['run', 'prerender']
在prerender
脚本中,我只需在启用prerender插件的情况下运行webpack。
但问题是在谷歌云中运行Puppeter,所以我不会附加任何网页包配置,我认为这是毫无意义的云构建使用自定义容器进行构建。有多种选择。然而,我不知道有一个包含headless Chrome:您可以为云构建构建自己的容器,并包含您需要的工具。