linux安裝puppeteer

1.安裝
下載淘寶鏡像的,能夠同時下載puppeteer和chromium下面兩條語句便可node

npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm i puppeteer

而後設置軟鏈接。linux

const pathToExtension = "/data/chenxiangan/webuiproject/node_modules/puppeteer/node_modules/_puppeteer@1.19.0@puppeteer/.local-chromium/linux-674921/chrome-linux/chrome";  下載好的chrome路徑
        const browser = await puppeteer.launch({
            executablePath: pathToExtension,
            headless: true,  //設置爲無頭模式
            args: ['--no-sandbox', '--disable-setuid-sandbox','--proxy-server=112.65.52.237:5672'] //這個是必須
        });
相關文章
相關標籤/搜索