Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to running on windows 10 and nodejs 18 error : Error: Unable to launch browser, error message: Failed to launch the browser process! [0110/004354.813:ERROR:icu_util.cc(243)] Invalid file descriptor to ICU data received. #506

Open
M1n007 opened this issue Jan 9, 2023 · 2 comments

Comments

@M1n007
Copy link

M1n007 commented Jan 9, 2023

I try to running a puppeteer-cluster on my windows 10 and nodejs 18, show error :

``` throw new Error(Unable to launch browser, error message: ${err.message});
^

Error: Unable to launch browser, error message: Failed to launch the browser process!
[0110/004354.813:ERROR:icu_util.cc(243)] Invalid file descriptor to ICU data received.
[0110/004354.813:FATAL:icu_util.cc(312)] Check failed: result.
Backtrace:
IsSandboxedProcess [0x00007FFE5146D0D2+1346194]
IsSandboxedProcess [0x00007FFE520D0DE2+14337954]
IsSandboxedProcess [0x00007FFE513EF1B2+830322]
IsSandboxedProcess [0x00007FFE513F0600+835520]
IsSandboxedProcess [0x00007FFE51627AEB+3159211]
CrashForExceptionInNonABICompliantCodeRange [0x00007FFE512D94F3+28949299]
CrashForExceptionInNonABICompliantCodeRange [0x00007FFE512D87B9+28945913]
CrashForExceptionInNonABICompliantCodeRange [0x00007FFE512D895E+28946334]
CrashForExceptionInNonABICompliantCodeRange [0x00007FFE51321DA7+29246439]
CrashForExceptionInNonABICompliantCodeRange [0x00007FFE51321C65+29246117]
CrashForExceptionInNonABICompliantCodeRange [0x00007FFE51321A43+29245571]
ChromeMain [0x00007FFE4DD21257+439]
GetPakFileHashes [0x00007FF6B33D29EA+6634]
GetPakFileHashes [0x00007FF6B33D1AA1+2721]
GetHandleVerifier [0x00007FF6B354ACF2+910370]
BaseThreadInitThunk [0x00007FFEEB317614+20]
RtlUserThreadStart [0x00007FFEEC8426A1+33]

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

Node.js v18.13.0```

this my sample code

`const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
puppeteer.use(StealthPlugin());
const AdblockerPlugin = require('puppeteer-extra-plugin-adblocker');
puppeteer.use(AdblockerPlugin({ blockTrackers: true }));
const { Cluster } = require('puppeteer-cluster');

const chromePaths = require('chrome-paths');

const fs = require('fs');
const moment = require('moment');
const chalk = require('chalk');
const delay = require('delay');
const readlineSync = require('readline-sync');
const cheerio = require('cheerio');
const async = require('async');

const os = require('os');

if (os.platform().toLowerCase().includes('win')) {
if (fs.existsSync('./node_modules/puppeteer-extra-plugin-user-data-dir/index.js')) {
let confData = fs.readFileSync('./node_modules/puppeteer-extra-plugin-user-data-dir/index.js', 'utf8');
if (!confData.includes('!this._userDataDir')) {
confData = confData.replace(/deleteUserDataDir()\s*{[\s\S]*?}/, `deleteUserDataDir() {
debug('removeUserDataDir', this._userDataDir)

            if (!this._userDataDir) {
              return
            }
        
            // We're using rimraf here because it throw errors and don't seem to freeze the process
            // If ressources busy or locked by chrome try again 4 times, then give up. overall a timout of 400ms
            rimraf(
              this._userDataDir,
              {
                maxBusyTries: 4
              }`);
        fs.writeFileSync('./node_modules/puppeteer-extra-plugin-user-data-dir/index.js', confData, 'utf8');
    }

} else {

}

}

function getString(start, end, all) {
const regex = new RegExp(${start}(.*?)${end});
const str = all
const result = regex.exec(str);
return result;
}

const inputValue = async (page, selector, value) => {
await page.waitForSelector(selector);
let inputUsername = await page.$(selector);
await inputUsername.click({ clickCount: 3 });
await page.keyboard.type(value)
return '';
};

(async () => {

const fileLocation = 'list.txt'

const dataEmail = fs.readFileSync(`./${fileLocation}`, 'utf-8');
const dataEmailArray = dataEmail.split('\n');



const args = [
    '--disable-web-security',
    '--disable-features=IsolateOrigins,site-per-process',
    '--allow-running-insecure-content',
    '--disable-blink-features=AutomationControlled',
    '--no-sandbox',
    '--mute-audio',
    '--no-zygote',
    '--no-xshm',
    '--window-size=1920,1080',
    '--no-first-run',
    '--no-default-browser-check',
    '--disable-dev-shm-usage',
    '--disable-gpu',
    '--enable-webgl',
    '--ignore-certificate-errors',
    '--lang=en-US,en;q=0.9',
    '--password-store=basic',
    '--disable-gpu-sandbox',
    '--disable-software-rasterizer',
    '--disable-background-timer-throttling',
    '--disable-backgrounding-occluded-windows',
    '--disable-renderer-backgrounding',
    '--disable-infobars',
    '--disable-breakpad',
    '--disable-canvas-aa',
    '--disable-2d-canvas-clip-aa',
    '--disable-gl-drawing-for-tests',
    '--enable-low-end-device-mode',
];

let browser = await puppeteer.launch({
    headless: false,
    ignoreHTTPSErrors: true,
    executablePath: chromePaths.chrome,
    slowMo: 0,
    devtools: false,
    args
});

let pages = await browser.pages();
let page = pages[0];
await page.setUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.88 Safari/537.36')

const cluster = await Cluster.launch({
    concurrency: Cluster.CONCURRENCY_CONTEXT,
    maxConcurrency: 1
});

await cluster.task(async ({ data }) => {
    const email = data.email.split('|')[0];


    await page.goto('https://www.site.com', {
        waitUntil: 'networkidle0',
        timeout: 120000,
    });

    await page.waitForSelector('#Email');
    await inputValue(page, '#Email', email);

});




for (let index = 0; index < dataEmailArray.length; index++) {
    const dataEmailArray1 = dataEmailArray[index];
    cluster.queue({ email: dataEmailArray1, index });
}

await cluster.idle();
await cluster.close();

})()`

@tamusjroyce
Copy link

Have you tried args: [ '--no-sandbox' ]?

Check that a good version of chrome is being found by chrome-paths. If you have multiple chrome, maybe it is finding an old or corrupt one?

Try chromium -> chromePaths?.Chromium
Try edge-paths -> getEdgePath() (will work under Linux)

@SashaDesigN
Copy link

it's puppeteer issue, check puppeteer repo issues can be something in them related to this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants