LoginSignup
3
1

More than 1 year has passed since last update.

【TypeScript】 ts-node で Unknown file extension ".ts" エラーが出るとき

Posted at

概要

ts-node で実行すると以下のエラーが出る場合の対処方法を残す

ts-node src/flow.ts                                                                           1 ✘  18:13:01  
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" xxxx

やり方

"type": "module"package.jsonから削除することで実行することができるようになる

package.json
{
-  "type": "module",
  "name": "practice",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1