Skip to content

regression in 21.4.0 when using esm package #51081

Closed as not planned
Closed as not planned

Description

@jeremymeng

Version

v21.4.0

Platform

Linux codespaces-8a914d 6.2.0-1016-azure #16~22.04.1-Ubuntu SMP Tue Oct 10 17:11:51 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

  1. npm init -y
  2. npm add esm
  3. create a file test.js with the following content
import { writeFileSync } from "fs";
console.log("hello");
  1. node -r esm test.js

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

always

What is the expected behavior? Why is that the expected behavior?

same as in v21.3.0

/workspaces/working/mocha/esm-test $ nvm use v21.3.0
Now using node v21.3.0 (npm v10.2.4)
/workspaces/working/mocha/esm-test $ node -r esm test.js
hello

What do you see instead?

content of esm.js is dumped to console for a TypeError

TypeError: Function.prototype.apply was called on undefined, which is a undefined and not a function
    at node:internal/main/run_main_module:28:49

Node.js v21.4.0

Additional information

No response

Activity

  1. targos commented on Dec 7, 2023

    @targos
    Member

    This is from #50907

    /cc @ronag @anonrig

  2. added
    fsIssues and PRs related to file-system APIs and the fs module.
    on Dec 7, 2023
  3. yoroshikun commented on May 6, 2024

    @yoroshikun

    This is also reproducible in node 22.x.x, 🙇 so revert needs to be applied there I think.

  4. GeoffreyBooth commented on May 6, 2024

    @GeoffreyBooth
    Member

    This isn't really a bug. We changed some undocumented internals that esm relied on, knowing it would break. Anyone can fork esm to update it accordingly; reverting the change would break other things now.

  5. added
    v22.xIssues that can be reproduced on v22.x or PRs targeting the v22.x-staging branch.
    and removed on Jul 16, 2024
  6. added
    wontfixIssues that will not be fixed.
    and removed
    regressionIssues related to regressions.
    v22.xIssues that can be reproduced on v22.x or PRs targeting the v22.x-staging branch.
    on Jul 16, 2024
  7. avivkeller commented on Jul 16, 2024

    @avivkeller
    Member

    Given @GeoffreyBooth's response, I've closed this as wontfix. If you disagree, feel free to reopen / leave a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to file-system APIs and the fs module.wontfixIssues that will not be fixed.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions