Puppeteer in Laradock: failed to launch the browser process EACCES

51 Views Asked by At

this is my puppeteer.lauch in my index2.js

  puppeteer.launch({
        headless: true,
        args: ['--disable-gpu', '--disable-setuid-sandbox', '--no-sandbox', '--no-zygote'],
        executablePath:'/root/.cache/puppeteer/chrome/linux-119.0.6045.105/chrome-linux64/chrome'
    })

This my handle in my craws-data:create to create data after crawl data in to database

    public function handle()
    {
        $campaign = $this->_getDataToRunJob();
        if ($campaign) {

            $signals = $this->_getSignals();
            $keyword = $campaign->keyword;
            $status = $campaign->status;
            $nextPage = ".RVQdVd";
            $linkCompanyElement = ".yuRUbf a[jsname=UWckNb]";
            $timeToStop = $campaign->time_to;
            $crawsDataId = $campaign->id;
            $nodePath = '/home/laradock/.nvm/versions/node/v18.19.0/bin/node';
            shell_exec(sprintf('%s crawl-contact-links/index2.js SIGNALS="%s" KEYWORD="%s" STATUS="%s" NEXT_PAGE="%s" LINK_COMPANY_ELEMENT="%s" TIME_TO_STOP="%s" CRAWS_DATA_ID="%s"', $nodePath, $signals, $keyword, $status, $nextPage, $linkCompanyElement, $timeToStop, $crawsDataId));
        }
    }

when command craws-data:create running. It return this error in log

Error: Failed to launch the browser process! spawn /root/.cache/puppeteer/chrome/linux-119.0.6045.105/chrome-linux64/chrome EACCES

When i try to run a command same as in handle it working fine

SIGNALS="contact" KEYWORD="Shopify ECサイト 大阪" STATUS=0 NEXT_PAGE=".RVQdVd" LINK_COMPANY_ELEMENT=".yuRUbf a[jsname=UWckNb]"  CRAWS_DATA_ID="18" node crawl-contact-links/index2.js
0

There are 0 best solutions below