Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

359
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda