national-gold
national-gold17mo ago

error TS2307: Cannot find module '@apify/log/log' or its corresponding type declarations.

I'm trying to build my Actor after not using it since last November and unfortunately, I'm getting build errors. The error I'm getting is:
2024-04-21T15:41:26.991Z node_modules/crawlee/node_modules/@crawlee/core/crawlers/crawler_extension.d.ts:8:17 - error TS2307: Cannot find module '@apify/log/log' or its corresponding type declarations.
2024-04-21T15:41:26.993Z 8 log: import("@apify/log/log").Log;
2024-04-21T15:41:26.995Z ~~~~~~~~~~~~~~~~
2024-04-21T15:41:26.997Z node_modules/crawlee/node_modules/@crawlee/core/storages/dataset.d.ts:145:17 - error TS2307: Cannot find module '@apify/log/log' or its corresponding type declarations.
2024-04-21T15:41:26.998Z 145 log: import("@apify/log/log").Log;
2024-04-21T15:41:27.000Z ~~~~~~~~~~~~~~~~
2024-04-21T15:41:27.002Z src/main.ts:27:5 - error TS2322: Type 'import("/home/myuser/node_modules/apify/proxy_configuration").ProxyConfiguration | undefined' is not assignable to type 'import("/home/myuser/node_modules/crawlee/node_modules/@crawlee/core/proxy_configuration").ProxyConfiguration | undefined'.
2024-04-21T15:41:27.003Z Type 'import("/home/myuser/node_modules/apify/proxy_configuration").ProxyConfiguration' is not assignable to type 'import("/home/myuser/node_modules/crawlee/node_modules/@crawlee/core/proxy_configuration").ProxyConfiguration'.
2024-04-21T15:41:27.005Z Property 'nextCustomUrlIndex' is protected but type 'ProxyConfiguration' is not a class derived from 'ProxyConfiguration'.
2024-04-21T15:41:27.007Z 27 proxyConfiguration,
2024-04-21T15:41:26.991Z node_modules/crawlee/node_modules/@crawlee/core/crawlers/crawler_extension.d.ts:8:17 - error TS2307: Cannot find module '@apify/log/log' or its corresponding type declarations.
2024-04-21T15:41:26.993Z 8 log: import("@apify/log/log").Log;
2024-04-21T15:41:26.995Z ~~~~~~~~~~~~~~~~
2024-04-21T15:41:26.997Z node_modules/crawlee/node_modules/@crawlee/core/storages/dataset.d.ts:145:17 - error TS2307: Cannot find module '@apify/log/log' or its corresponding type declarations.
2024-04-21T15:41:26.998Z 145 log: import("@apify/log/log").Log;
2024-04-21T15:41:27.000Z ~~~~~~~~~~~~~~~~
2024-04-21T15:41:27.002Z src/main.ts:27:5 - error TS2322: Type 'import("/home/myuser/node_modules/apify/proxy_configuration").ProxyConfiguration | undefined' is not assignable to type 'import("/home/myuser/node_modules/crawlee/node_modules/@crawlee/core/proxy_configuration").ProxyConfiguration | undefined'.
2024-04-21T15:41:27.003Z Type 'import("/home/myuser/node_modules/apify/proxy_configuration").ProxyConfiguration' is not assignable to type 'import("/home/myuser/node_modules/crawlee/node_modules/@crawlee/core/proxy_configuration").ProxyConfiguration'.
2024-04-21T15:41:27.005Z Property 'nextCustomUrlIndex' is protected but type 'ProxyConfiguration' is not a class derived from 'ProxyConfiguration'.
2024-04-21T15:41:27.007Z 27 proxyConfiguration,
Of these issues, the first two seem to be related to Crawlee internally and I'm not sure what to do about it. Some dependency issue in my package.json file? Any help would be greatly appreciated! I'll paste the package.json file in the next comment. If anyone has any ideas on the third issue as well, that would be greatly appreciated too!
6 Replies
national-gold
national-goldOP17mo ago
{
"name": "GE-crawler",
"version": "0.0.1",
"type": "module",
"description": "Giant Eagle actor.",
"engines": {
"node": ">=18.20.2"
},
"dependencies": {
"apify": "3.1.12",
"crawlee": "3.5.7",
"playwright": "1.39.0"
},
"devDependencies": {
"@apify/eslint-config-ts": "^0.2.3",
"@apify/tsconfig": "0.1.0",
"@typescript-eslint/eslint-plugin": "7.7.0",
"@typescript-eslint/parser": "7.7.0",
"eslint": "^8.20.0",
"ts-node": "10.9.2",
"typescript": "5.2.2"
},
"scripts": {
"start": "npm run start:dev",
"start:prod": "node dist/main.js",
"start:dev": "ts-node-esm -T src/main.ts",
"build": "tsc",
"lint": "eslint ./src --ext .ts",
"lint:fix": "eslint ./src --ext .ts --fix",
"test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1"
},
"author": "HK",
"license": "ISC"
}
{
"name": "GE-crawler",
"version": "0.0.1",
"type": "module",
"description": "Giant Eagle actor.",
"engines": {
"node": ">=18.20.2"
},
"dependencies": {
"apify": "3.1.12",
"crawlee": "3.5.7",
"playwright": "1.39.0"
},
"devDependencies": {
"@apify/eslint-config-ts": "^0.2.3",
"@apify/tsconfig": "0.1.0",
"@typescript-eslint/eslint-plugin": "7.7.0",
"@typescript-eslint/parser": "7.7.0",
"eslint": "^8.20.0",
"ts-node": "10.9.2",
"typescript": "5.2.2"
},
"scripts": {
"start": "npm run start:dev",
"start:prod": "node dist/main.js",
"start:dev": "ts-node-esm -T src/main.ts",
"build": "tsc",
"lint": "eslint ./src --ext .ts",
"lint:fix": "eslint ./src --ext .ts --fix",
"test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1"
},
"author": "HK",
"license": "ISC"
}
I realize that one possible answer is to upgrade dependencies, such as Crawlee, to the latest version, but I want to avoid an armageddon scenario where I have to rewrite the entire crawler 😄
memo23
memo2317mo ago
@Red Guy dm me
Alexey Udovydchenko
Try: "@Apify/eslint-config": "^0.3.1", "@Apify/eslint-config-ts": "^0.4.1", "@Apify/tsconfig": "^0.1.0", "eslint": "^8.20.0", "typescript": "^5.3.3",
national-gold
national-goldOP17mo ago
@Alexey Udovydchenko Thanks a lot for your assistance! Unfortunately, the error is the exact same. Pasting my package.json as well as the build output.
{
"name": "GE-crawler",
"version": "0.0.1",
"type": "module",
"description": "Giant Eagle actor.",
"engines": {
"node": ">=18.20.2"
},
"dependencies": {
"apify": "3.1.12",
"crawlee": "3.5.7",
"playwright": "1.39.0"
},
"devDependencies": {
"@apify/eslint-config-ts": "^0.4.1",
"@apify/eslint-config": "^0.3.1",
"@apify/tsconfig": "^0.1.0",
"@typescript-eslint/eslint-plugin": "7.7.0",
"@typescript-eslint/parser": "7.7.0",
"eslint": "^8.20.0",
"ts-node": "10.9.2",
"typescript": "^5.3.3"
},
"scripts": {
"start": "npm run start:dev",
"start:prod": "node dist/main.js",
"start:dev": "ts-node-esm -T src/main.ts",
"build": "tsc",
"lint": "eslint ./src --ext .ts",
"lint:fix": "eslint ./src --ext .ts --fix",
"test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1"
},
"author": "HK",
"license": "ISC"
}
{
"name": "GE-crawler",
"version": "0.0.1",
"type": "module",
"description": "Giant Eagle actor.",
"engines": {
"node": ">=18.20.2"
},
"dependencies": {
"apify": "3.1.12",
"crawlee": "3.5.7",
"playwright": "1.39.0"
},
"devDependencies": {
"@apify/eslint-config-ts": "^0.4.1",
"@apify/eslint-config": "^0.3.1",
"@apify/tsconfig": "^0.1.0",
"@typescript-eslint/eslint-plugin": "7.7.0",
"@typescript-eslint/parser": "7.7.0",
"eslint": "^8.20.0",
"ts-node": "10.9.2",
"typescript": "^5.3.3"
},
"scripts": {
"start": "npm run start:dev",
"start:prod": "node dist/main.js",
"start:dev": "ts-node-esm -T src/main.ts",
"build": "tsc",
"lint": "eslint ./src --ext .ts",
"lint:fix": "eslint ./src --ext .ts --fix",
"test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1"
},
"author": "HK",
"license": "ISC"
}
Step 5/12 : RUN npm run build
> Running in 0579995e16c6
GE-crawler@0.0.1 build
2024-04-22T12:28:36.183Z > tsc
node_modules/crawlee/node_modules/@crawlee/core/crawlers/crawler_extension.d.ts:8:17 - error TS2307: Cannot find module '@apify/log/log' or its corresponding type declarations.
import("@apify/log/log").Log;
2024-04-22T12:28:43.069Z
~~~~~~~~~~~~~~~~
node_modules/crawlee/node_modules/@crawlee/core/storages/dataset.d.ts:145:17 - error TS2307: Cannot find module '@apify/log/log' or its corresponding type declarations.
2024-04-22T12:28:43.071Z 145 log: import("@apify/log/log").Log
~~~~~~~~~~~~~~~~
src/main.ts:27:5 - error TS2322: Type 'import("/home/myuser/node_modules/apify/proxy_configuration").ProxyConfiguration | undefined' is not assignable to type 'import("/home/myuser/node_modules/crawlee/node_modules/@crawlee/core/proxy_configuration").ProxyConfiguration | undefined'.
Type 'import("/home/myuser/node_modules/apify/proxy_configuration").ProxyConfiguration' is not assignable to type 'import("/home/myuser/node_modules/crawlee/node_modules/@crawlee/core/proxy_configuration").ProxyConfiguration'.
2024-04-22T12:28:43.074Z Property 'nextCustomUrlIndex' is protected but type 'ProxyConfiguration' is not a class derived from 'ProxyConfiguration'.
2024-04-22T12:28:43.076Z 27 proxyConfiguration,
2024-04-22T12:28:43.076Z
~~~~~~~~~~~~~~~~~~
2024-04-22T12:28:43.077Z Found 3 errors in 3 files.
2024-04-22T12:28:43.078Z Errors Files
2024-04-22T12:28:43.079Z 1 node_modules/crawlee/node_modules/@crawlee/core/crawlers/crawler_extension.d.ts:8
2024-04-22T12:28:43.080Z 1 node_modules/crawlee/node_modules/@crawlee/core/storages/dataset.d.ts:145
2024-04-22T12:28:43.081Z 1 src/main.ts:27
2024-04-22T12:28:43.846Z Removing intermediate container 0579995e16c6
2024-04-22T12:28:43.851Z ACTOR: ERROR: Docker image build failed: The command '/bin/sh -c npm run build' returned a non-zero code: 2
Step 5/12 : RUN npm run build
> Running in 0579995e16c6
GE-crawler@0.0.1 build
2024-04-22T12:28:36.183Z > tsc
node_modules/crawlee/node_modules/@crawlee/core/crawlers/crawler_extension.d.ts:8:17 - error TS2307: Cannot find module '@apify/log/log' or its corresponding type declarations.
import("@apify/log/log").Log;
2024-04-22T12:28:43.069Z
~~~~~~~~~~~~~~~~
node_modules/crawlee/node_modules/@crawlee/core/storages/dataset.d.ts:145:17 - error TS2307: Cannot find module '@apify/log/log' or its corresponding type declarations.
2024-04-22T12:28:43.071Z 145 log: import("@apify/log/log").Log
~~~~~~~~~~~~~~~~
src/main.ts:27:5 - error TS2322: Type 'import("/home/myuser/node_modules/apify/proxy_configuration").ProxyConfiguration | undefined' is not assignable to type 'import("/home/myuser/node_modules/crawlee/node_modules/@crawlee/core/proxy_configuration").ProxyConfiguration | undefined'.
Type 'import("/home/myuser/node_modules/apify/proxy_configuration").ProxyConfiguration' is not assignable to type 'import("/home/myuser/node_modules/crawlee/node_modules/@crawlee/core/proxy_configuration").ProxyConfiguration'.
2024-04-22T12:28:43.074Z Property 'nextCustomUrlIndex' is protected but type 'ProxyConfiguration' is not a class derived from 'ProxyConfiguration'.
2024-04-22T12:28:43.076Z 27 proxyConfiguration,
2024-04-22T12:28:43.076Z
~~~~~~~~~~~~~~~~~~
2024-04-22T12:28:43.077Z Found 3 errors in 3 files.
2024-04-22T12:28:43.078Z Errors Files
2024-04-22T12:28:43.079Z 1 node_modules/crawlee/node_modules/@crawlee/core/crawlers/crawler_extension.d.ts:8
2024-04-22T12:28:43.080Z 1 node_modules/crawlee/node_modules/@crawlee/core/storages/dataset.d.ts:145
2024-04-22T12:28:43.081Z 1 src/main.ts:27
2024-04-22T12:28:43.846Z Removing intermediate container 0579995e16c6
2024-04-22T12:28:43.851Z ACTOR: ERROR: Docker image build failed: The command '/bin/sh -c npm run build' returned a non-zero code: 2
If you, or anyone else, has ideas, that would be greatly appreciated! 🙏 🙏 🙏
Alexey Udovydchenko
Please try to use latest crawlee and apify, to debug locally just "npm run build"
Oleg V.
Oleg V.17mo ago
yeah, should be good with latest crawlee (3.9.2). if no luck. Maybe Try to create a new project from scratch. via npx apify-cli create my-crawler Just don't forget to update apify-cli to latest

Did you find this page helpful?