Skip to content

ESM loader cannot detect module system properly in folder whose name ends with node_modules #51245

@AnnAngela

Description

@AnnAngela

Version

v20.10.0

Platform

Linux 4.4.0-19041-Microsoft #3636-Microsoft Thu Oct 19 17:41:00 PST 2023 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

modules/esm

What steps will reproduce the bug?

The repo: https://github.com/AnnAngela/node-issue

The reproduce steps: https://github.com/AnnAngela/node-issue/blob/08407276c119b18f12f0deb1193d4815dc8d6956/.github/workflows/test.yaml#L21-L22

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

Always reproduce, with the workding folder whose name ends with node_modules

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

Should not throw any error.

What do you see instead?

The workflow log: https://github.com/AnnAngela/node-issue/actions/runs/7285434922/job/19852334885#step:4:13

Additional information

I'm not sure if the working directory can only end with node_modules, or can start with node_modules or contain node_modules in the middle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.loadersIssues and PRs related to ES module loaders

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions