From 1e20961168dd5845b56ac901d6ef1362a8652020 Mon Sep 17 00:00:00 2001 From: UZIhuhuhu <1908341144@qq.com> Date: Mon, 14 Oct 2019 19:52:22 +0800 Subject: [PATCH] modify startup params --- package.json | 3 ++- pupp.js | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f787d2b..b6e5bcd 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "license": "MIT", "scripts": { "tradition": "node tradition/index.js", - "pupp": "node pupp.js" + "pupp:dev": "NODE_ENV=dev node pupp.js", + "pupp:prod": "NODE_ENV=prod node pupp.js" }, "dependencies": { "axios": "^0.19.0", diff --git a/pupp.js b/pupp.js index 4ef4d50..7d0b7fb 100644 --- a/pupp.js +++ b/pupp.js @@ -11,7 +11,20 @@ const main = async () => { return console.log(">>>>>>>> 先改个账号密码再来吧"); const start = performance.now(); - const browser = await puppeteer.launch({ headless: false }); + const browser = await puppeteer.launch({ + headless: process.env.NODE_ENV === "dev" ? false : true, + ignoreHTTPSErrors: true, + args: [ + "--disable-web-security", + "--disable-setuid-sandbox", + "--no-sandbox", + "--disable-gpu", + "--disable-dev-shm-usage", + "--no-first-run", + "--no-zygote", + "--disable-popup-blocking" + ] + }); const page = await browser.newPage(); await page._client.send("Network.clearBrowserCookies");