Using esm (ES6 modules) causes failure.
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 6.4.1
- Platform / OS version: Linux latitude 4.15.0-36-generic #39-Ubuntu SMP Mon Sep 24 16:19:09 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
- URLs (if applicable):
- Node.js version: 10.10.0
What steps will reproduce the problem?
Please include code that reproduces the issue.
- copy example code into a new file example.js
- replace
const puppeteer = require('puppeteer')
withìmport puppeteer from 'puppeteer'
- run with
node -r esm example.js
What is the expected result?
Empty prompt, example.png
in script folder.
What happens instead?
node -r esm demo.js
(node:11730) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'on' of undefined
at Function.addEventListener (../node_modules/puppeteer/lib/helper.js:165:13)
at new NavigatorWatcher (../node_modules/puppeteer/lib/FrameManager.js:1146:14)
at FrameManager.navigateFrame (../node_modules/puppeteer/lib/FrameManager.js:75:21)
at Frame.goto (../node_modules/puppeteer/lib/FrameManager.js:404:37)
at Page.goto (../node_modules/puppeteer/lib/Page.js:579:49)
at require (../demo.js:6:14)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:11730) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:11
- Comments:20 (6 by maintainers)
Top Results From Across the Web
Avoid these issues when using new ECMAScript modules in ...
Es6 modules now have full support in Node.js 12 and above so it's time ... package/main.js it will fail with an error ERR_MODULE_NOT_FOUND....
Read more >Node Modules at War: Why CommonJS and ES ... - Code Red
Many observers of the Node ecosystem have speculated that these rules are due to a failure of leadership, or even hostility toward ESM....
Read more >Error [ERR_REQUIRE_ESM]: require() of ES Module not ...
I just had to downgrade node-fetch to 2.6.6, as the higher versions only use ESM, which caused a lot of errors.
Read more >Using ECMAScript modules (ESM) with Node.js
js require mjs ; require function. On the other side, if you try the ; from syntax, we'll get an error because CommonJS...
Read more >How to Bypass ES Modules Errors in Next.js with Dynamic ...
In this article, I'll walk you through an error you may get when you are ... was approved when ES6 (ECMAScript 6) was...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, likely within a
week or so.Well that week-or-so turned into a bit longer with the US Thanksgiving holiday. I should release before I start more aggressive perf work. I’ll ping back this thread when it’s released.