apify / actor-templates

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

Apify run error when using Typescript template #230

Closed shengzhou1216 closed 9 months ago

shengzhou1216 commented 9 months ago

Platform:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy

Node:

v20.5.1

Npm:

10.2.4

Used template:

 ts-start

Run apify run got this error:

Run: npm start

> my-hello-world@0.0.1 start
> npm run start:dev

> my-hello-world@0.0.1 start:dev
> node --no-warnings=ExperimentalWarning --loader ts-node/esm/transpile-only src/main.ts

node:internal/process/esm_loader:46
      internalBinding('errors').triggerUncaughtException(
                                ^
TypeError [Error]: state.conditions.includes is not a function
    at loadModuleFromTargetImportOrExport (/home/sheng/workspace/apify/my-hello-world/node_modules/typescript/lib/typescript.js:41322:61)
    at loadModuleFromExports (/home/sheng/workspace/apify/my-hello-world/node_modules/typescript/lib/typescript.js:41063:16)
    at loadModuleFromSpecificNodeModulesDirectory (/home/sheng/workspace/apify/my-hello-world/node_modules/typescript/lib/typescript.js:41582:20)
    at loadModuleFromImmediateNodeModulesDirectory (/home/sheng/workspace/apify/my-hello-world/node_modules/typescript/lib/typescript.js:41525:29)
    at /home/sheng/workspace/apify/my-hello-world/node_modules/typescript/lib/typescript.js:41513:33
    at forEachAncestorDirectory (/home/sheng/workspace/apify/my-hello-world/node_modules/typescript/lib/typescript.js:6975:22)
    at lookup (/home/sheng/workspace/apify/my-hello-world/node_modules/typescript/lib/typescript.js:41507:14)
    at loadModuleFromNearestNodeModulesDirectoryWorker (/home/sheng/workspace/apify/my-hello-world/node_modules/typescript/lib/typescript.js:41498:22)
    at loadModuleFromNearestNodeModulesDirectory (/home/sheng/workspace/apify/my-hello-world/node_modules/typescript/lib/typescript.js:41467:12)
    at tryResolve (/home/sheng/workspace/apify/my-hello-world/node_modules/typescript/lib/typescript.js:40523:23)

Node.js v20.5.1
B4nan commented 9 months ago

This is caused by TypeScript 5.3 (and is most likely a TS bug, not much we can do here), please downgrade to 5.2.2 for now.

B4nan commented 9 months ago

I've pinned the TS version to 5.2 in our templates, do the same in your project to fix this. We will need to report this to the TS team to find a solution (probably on their end).