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

CustomError via `apify run` command #155

Closed denbon05 closed 1 year ago

denbon05 commented 1 year ago

I've run into an error by following the documentation of templates. Checked templates where error occurred:

Steps to reproduce:

npm -g install apify-cli
apify create my-typescript-actor -t getting_started_typescript
cd my-typescript-actor
apify run

Cause an error:

Run: npm start

> my-typescript-actor@0.0.1 start
> npm run start:dev

> my-typescript-actor@0.0.1 start:dev
> ts-node-esm -T src/main.ts

/tmp/my-typescript-actor/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:366
    throw new ERR_MODULE_NOT_FOUND(
          ^
CustomError: Cannot find module '/tmp/my-typescript-actor/node_modules/apify/dist/index.mjs' imported from /tmp/my-typescript-actor/src/main.ts
    at finalizeResolution (/tmp/my-typescript-actor/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:366:11)
    at moduleResolve (/tmp/my-typescript-actor/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:801:10)
    at Object.defaultResolve (/tmp/my-typescript-actor/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:912:11)
    at /tmp/my-typescript-actor/node_modules/ts-node/src/esm.ts:218:35
    at entrypointFallback (/tmp/my-typescript-actor/node_modules/ts-node/src/esm.ts:168:34)
    at /tmp/my-typescript-actor/node_modules/ts-node/src/esm.ts:217:14
    at addShortCircuitFlag (/tmp/my-typescript-actor/node_modules/ts-node/src/esm.ts:409:21)
    at resolve (/tmp/my-typescript-actor/node_modules/ts-node/src/esm.ts:197:12)
    at resolve (/tmp/my-typescript-actor/node_modules/ts-node/src/child/child-loader.ts:15:39)
    at nextResolve (node:internal/modules/esm/loader:163:28)
Error: npm exited with code 1

system data:

$ apify -v  
apify-cli/0.16.1 linux-x64 node-v18.12.1

# os
Ubuntu 22.04.2 LTS
B4nan commented 1 year ago

This is already fixed with apify@3.1.7, the problem was in a malformed package.json in previous SDK version.