Skip to content

Fail to load request-promise-native with --experimental-modules #25310

@badeball

Description

@badeball

Hi,

I've been using experimental modules for some time now, but encountered an issue with node-11.4 in combination with request-promise-native. The mentioned module is using stealthy-request to do something clever.

Below is an example command that illustrates the problem by throwing an error in node-11.{4,5,6}, but exits successfully in node-11.3.

docker run \
  node:11.4-alpine \
  sh -c " \
    npm install request request-promise-native && \
    node \
    --experimental-modules \
    --no-warnings \
    --require request-promise-native"

I attempted to bisect the source and found 1743568 from #24560 to have introduced the change in behavior (@MylesBorins).

I'm not sure if this is an issue with node or if stealthy-require is doing something it shouldn't, but I figured I should mentioned it anyway.

The error thrown:

internal/modules/cjs/loader.js:631
      module.reflect.onReady((reflect) => {
                     ^

TypeError: Cannot read property 'onReady' of undefined
    at Module.load (internal/modules/cjs/loader.js:631:22)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Module.require (internal/modules/cjs/loader.js:659:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/node_modules/psl/index.js:14:19)
    at Module._compile (internal/modules/cjs/loader.js:723:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:734:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)

Metadata

Metadata

Assignees

No one assigned

    Labels

    esmIssues and PRs related to the ECMAScript Modules implementation.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions