apify / actor-templates

This project is the :house: home of Apify actor template projects to help users quickly get started.
https://apify.com/
25 stars 15 forks source link

ERR_UNKNOWN_FILE_EXTENSION on Node v20.0.0 #167

Closed B4nan closed 12 months ago

B4nan commented 1 year ago

ts-node-esm is broken in node v20+ (tested on v20.4), we should move to node --no-warnings=ExperimentalWarning --loader ts-node/esm src/main.ts before it's fixed.

> ts-node-esm -T src/main.ts

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/adamek/htdocs/apify/test-ts-actor/src/main.ts
    at new NodeError (node:internal/errors:405:5)
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:99:9)
    at defaultGetFormat (node:internal/modules/esm/get_format:142:36)
    at defaultLoad (node:internal/modules/esm/load:91:20)
    at nextLoad (node:internal/modules/esm/hooks:733:28)
    at load (/Users/adamek/htdocs/apify/test-ts-actor/node_modules/ts-node/dist/child/child-loader.js:19:122)
    at nextLoad (node:internal/modules/esm/hooks:733:28)
    at Hooks.load (node:internal/modules/esm/hooks:377:26)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:168:24)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:778:20) {
  code: 'ERR_UNKNOWN_FILE_EXTENSION'
}

Related: https://github.com/apify/crawlee/issues/1966