Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

360
Visualizações
Error with Puppeteer when using Parcel bundler

I have a problem with a script containing Puppeeter when I run it with Parcel. When I launched it with command line, without building with Parcel, it works fine.

My first error was the message : Uncaught SyntaxError:missing = in const declaration

It appears because the variable const PUPPETEER_EXPERIMENTAL_CHROMIUM_MAC_ARM; was not initialized in the index.87e9977b.js file in the dist folder created by Parcel.

So I tried to add the variable to my environment variables, and to npm config file, but it didn't worked, so I just commented the line.

After that I had many other errors showing as in the picture below. enter image description here

Here is the code of my script WebScrapperPuppeteer.ts. It works when not using Parcel.

const puppeteer = require('puppeteer');
const fs = require('fs');

async function main(){
    const browser = await puppeteer.launch();
    const page = await browser.newPage();
    await page.goto("https://unsplash.com/t/animals", {waitUntil: "domcontentloaded"});
    //await page.waitFor(5000);
    await page.screenshot({path:'test.png'});
    let images = await page.evaluate(()=> {
        let img = Array.from(
            document.querySelectorAll("img.YVj9w")
            ).map((image) => image.getAttribute("src"));
        return img;
    });

    console.log(images);
    await browser.close();
}

main();

I don't want to change Parcel if possible, because for everything else it is very convenient.

Thanks in advance for your help :)

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda