Skip to content

Cannot start file without extension with --experimental-specifier-resolution=node #38933

Closed

Description

@tsapko3628
  • Version: 14.17.0, 16.2.0, 16.3.0
  • Platform: maxOS Big Sur 11.14.0
  • Subsystem:

What steps will reproduce the bug?

Install typescript and run npx tsc with NODE_OPTIONS="--experimental-specifier-resolution=node"

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

Always

What is the expected behavior?

Run typescript compiler correctly

What do you see instead?

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

TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module "file:///path/to/project/node_modules/typescript/bin/tsc" 
    at Loader.getFormat (internal/modules/esm/loader.js:117:13)
    at async Loader.getModuleJob (internal/modules/esm/loader.js:242:20)
    at async Loader.import (internal/modules/esm/loader.js:176:17)
    at async Object.loadESM (internal/process/esm_loader.js:68:5) {
  code: 'ERR_INVALID_MODULE_SPECIFIER'
}

Additional information

microsoft/TypeScript#44342

Activity

  1. changed the title [-]--experimental-specifier-resolution=node Cannot start file without extension[/-] [+]Cannot start file without extension with `--experimental-specifier-resolution=node`[/+] on Jun 4, 2021
  2. aduh95 commented on Jun 4, 2021

    @aduh95
    Contributor

    That looks like a npm issue, not a Node.js one. You should open an issue on their repo (https://github.com/npm/cli), they probably want to fix that indeed.

  3. added
    wrong repoIssues that should be opened in another repository.
    on Jun 4, 2021
  4. aduh95 commented on Jun 4, 2021

    @aduh95
    Contributor

    Reading through the linked issue, it looks like your issue is not related to npx exactly, it's really the extensionless part that is at stake here, sorry I read the OP too fast. In this case, I think your issue is a duplicate of #35518.

    If I've missed something, feel free to give more details and to reopen this issue :)

  5. added
    duplicateIssues and PRs that are duplicates of other issues or PRs.
    and removed
    wrong repoIssues that should be opened in another repository.
    on Jun 4, 2021
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

    duplicateIssues and PRs that are duplicates of other issues or PRs.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions