Skip to content

Crash when using NODE_OPTIONS=--experimental-specifier-resolution=node with some .bin executables #35518

@daveisfera

Description

@daveisfera
  • Version: 14.13.0
  • Platform: macOS 10.15.6
  • Subsystem:

What steps will reproduce the bug?

NODE_OPTIONS=--experimental-specifier-resolution=node node_modules/.bin/semver --version

How often does it reproduce? Is there a required condition?

100%

What is the expected behavior?

Runs just like when NODE_OPTIONS isn't set

What do you see instead?

This error:

internal/process/esm_loader.js:74
    internalBinding('errors').triggerUncaughtException(
                              ^

TypeError [ERR_INVALID_RETURN_PROPERTY_VALUE]: Expected string to be returned for the "format" from the "loader getFormat" function but got type object.
    at Loader.getFormat (internal/modules/esm/loader.js:110:13)
    at async Loader.getModuleJob (internal/modules/esm/loader.js:230:20)
    at async Loader.import (internal/modules/esm/loader.js:164:17)
    at async Object.loadESM (internal/process/esm_loader.js:68:5) {
  code: 'ERR_INVALID_RETURN_PROPERTY_VALUE'
}

Additional information

Also happens with he, mocha, node-which, and tsc

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.esmIssues and PRs related to the ECMAScript Modules implementation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions