Skip to content

Using esm (ES6 modules) causes failure. #3382

Description

@Rob-pw

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 6.4.1
  • Platform / OS version: Linux latitude 4.15.0-36-generic Bikeshed the API #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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    chromiumIssues with Puppeteer-Chromium

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions