Skip to content

Error: unknown file extension .ts #1062

@Thomas1664

Description

@Thomas1664

Expected Behavior

Load typescript files

Actual Behavior

When I try to execute a typescript file I get the following error message:
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /home/$USERNAME/$PATH_TO_DEV_FOLEDER/index.ts
at Loader.defaultGetFormat [as _getFormat] (internal/modules/esm/get_format.js:65:15)
at Loader.getFormat (internal/modules/esm/loader.js:113:42)
at Loader.getModuleJob (internal/modules/esm/loader.js:243:31)
at Loader.import (internal/modules/esm/loader.js:177:17)

Steps to reproduce the problem

launch ts-node index.ts

Minimal reproduction

Specifications

  • ts-node version: v8.10.2 (installed global)
  • node version: v14.3.0
  • TypeScript version:v3.9.3 (installed global)
  • tsconfig.json, if you're using one:
{}
  • Operating system and version: Windows 10 Version 2004
  • If Windows, are you using WSL or WSL2?: Yes, Ubuntu 20.04 LTS in WSL2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions