question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using esm (ES6 modules) causes failure.

See original GitHub issue

Steps 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.

  1. copy example code into a new file example.js
  2. replace const puppeteer = require('puppeteer') with ìmport puppeteer from 'puppeteer'
  3. 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:closed
  • Created 5 years ago
  • Reactions:11
  • Comments:20 (6 by maintainers)

github_iconTop GitHub Comments

8reactions
jdaltoncommented, Jan 11, 2019

Yes, likely within a week or so.

4reactions
jdaltoncommented, Nov 27, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found