-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Closed
Labels
Description
This is the full error message:
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added. Use emitter.setMaxListeners() to increase limit
I run Node v8.1.2 with tip-of-tree Puppeteer
The code is written with Promise.all, but even if I run work() sequentially the same error appears.
const puppeteer = require('puppeteer')
const R = require('rambda')
const resolution = {
x : 1920,
y : 1080,
}
const args = [
'--disable-gpu',
`--window-size=${ resolution.x },${ resolution.y }`,
'--no-sandbox',
]
const work = async () => {
const browser = await puppeteer.launch({
headless : true,
handleSIGINT : false,
args : args,
})
const page = await browser.newPage()
const url = 'https://ilearnsmarter.com/learning-meme'
await page.setViewport({
width : resolution.x,
height : resolution.y,
})
await page.goto(url, { waitUntil : 'networkidle' })
await browser.close()
}
const fn = async () => {
const promised = R.range(0, 12).map(() => work())
await Promise.all(promised)
console.log('DONE')
}
fn()