My bitbucket-pipelines.yml :
pipelines:
default:
- step:
name: Install Chrome
image: node:latest
caches:
- node
script:
- apt-get update
- apt-get install -y wget gnupg xvfb
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
- echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
- apt-get update
- apt-get install -y google-chrome-stable
- ln -sf /usr/bin/google-chrome /usr/bin/chrome
- chmod 755 /usr/bin/chrome
- google-chrome --version
- which google-chrome
- node --version
- npm --version
- npm install
- npm run json-web
- cat assets/web.json
Puppeteer lanch code:
const browser = await puppeteer.launch({
executablePath: `/usr/bin/google-chrome`,
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--disable-accelerated-2d-canvas',
'--no-first-run',
'--no-zygote',
'--single-process', // <- this one doesn't works in Windows
'--disable-gpu'
],
headless: true,
// 设置视窗的宽高
defaultViewport: {
width: 1920,
height: 1080,
},
});
Hi @Kirk-Platform-FE and welcome to the community!
When you say it works locally, are you running this directly on your machine?
If so, your machine's environment is different from the environment where the Pipelines build runs. Pipelines builds run in Docker containers based on the image you specify in your yml file (in your case, it's node:latest).
The best way to troubleshoot a failed build in an environment similar to Pipelines, is to debug it locally with Docker by following this guide:
I suggest following this guide and ensuring you reset the local repo to the correct commit hash (Step 2) and use the correct Docker image hash (Step 3). If possible, I also suggest following the guide on a Linux machine to rule out any issues that may have to do with different platforms.
If you follow these steps and the build still fails, it is not an issue with Pipelines and you need to debug further and figure out why the build doesn't run in this container.
If you follow our troubleshooting guide and the build succeeds, you can create a ticket with the support team and provide:
You can create a ticket via https://support.atlassian.com/contact/#/, in "What can we help you with?" select "Technical issues and bugs" and then Bitbucket Cloud as product. When you are asked to provide the workspace URL, please make sure you enter the URL of the workspace that is on a paid billing plan to proceed with ticket creation.
Please feel free to reach out if you have any questions.
Kind regards,
Theodora
@Kirk-Platform-FE Welcome! If you run this not in pipeline but manually it runs successfully ?
Nicolas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes! It words well locally if I delete this line:
executablePath: '/usr/bin/google-chrome'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.