0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

npx ts-nodeでTypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" エラーを直すためにtsxを入れよう

Last updated at Posted at 2024-06-13

npx ts-nodeを実行するとエラーが出る

環境:node:20

このバージョンだとts-node を使ってtypescriptを直接実行はできないのでtsxというライブラリを利用します

代わりとなるライブラリtsx

npm i tsx

これで実行できるようになります!

npx tsx ...

コレで実行できます!

こちらを利用してprismaのseedデータの追加を以下の記事に記述しています
興味があればぜひ!

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?