You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
❯ apify create
? Name of your new actor: test-ts-actor
? Choose the programming language of your new actor: TypeScript
? Choose a template for your new actor. Detailed information about the template will be shown in the
next step. Start with TypeScript
? Do you want to install the following template?
Start with TypeScript:
A simple TypeScript example of core Actor and Apify SDK features. It reads and validates user input
with schema, computes a result and saves it to storage. Install template
Run: npm install
added 149 packages, and audited 150 packages in 14s
31 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Success: Actor 'test-ts-actor' was created. To run it, run "cd test-ts-actor" and "apify run".
Then, doing what it asks:
❯ apify run
Run: npm start
> [email protected] start
> npm run start:dev
> [email protected] start:dev
> ts-node-esm -T src/main.ts
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for <SNIP>/test-ts-actor/src/main.ts
at new NodeError (node:internal/errors:399:5)
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:99:9)
at defaultGetFormat (node:internal/modules/esm/get_format:139:38)
at defaultLoad (node:internal/modules/esm/load:83:20)
at nextLoad (node:internal/modules/esm/hooks:735:28)
at load (<SNIP>/test-ts-actor/node_modules/ts-node/dist/child/child-loader.js:19:122)
at nextLoad (node:internal/modules/esm/hooks:735:28)
at Hooks.load (node:internal/modules/esm/hooks:380:26)
at MessagePort.handleMessage (node:internal/modules/esm/worker:165:24)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:762:20) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
Error: npm exited with code 1
This is on latest MacOS with Node 20 installed from Brew/Homebrew.
Downgrading to Node 18 (latest LTS) resolves the problem.
The text was updated successfully, but these errors were encountered:
Sounds like a ts-node issue, not really about the CLI (that just runs npm start for you). I guess you get the same problem when you do npm start or run the command that it wraps (so ts-node-esm -T src/main.ts)?
Does node --loader ts-node/esm src/main.ts work? That's what people suggest in the issue you linked.
gippy
added
the
t-tooling
Issues with this label are in the ownership of the tooling team.
label
Jun 5, 2023
Minimal reproduction:
Then, doing what it asks:
This is on latest MacOS with Node 20 installed from Brew/Homebrew.
Downgrading to Node 18 (latest LTS) resolves the problem.
The text was updated successfully, but these errors were encountered: