Apify and Crawlee Official Forum

Updated 3 months ago

Error: Error: Cannot find module '/home/myuser/dist/main.js'

I am getting the error: Error:
Plain Text
 Cannot find module '/home/myuser/dist/main.js' 

when trying to run a successfull build for my actor on Apify, but locally it works without errors.
I have disabled a lot of linting and warnings as they serve me no real purpose other than stop my typescript compliation from succeeding.
It is a Typescript Crawlee project.

Do you have any idea of what might be the cause?
2
o
L
C
9 comments
Hi, it looks like docker build doesn't put built js files to the right place. Could you share the content of your Dockerfile?
You must have changed something from the template
Hmm I will try to delve into what might be changed
I have done the cahnges in tsconfig to try to disable warnings for unused variables as this should not make compilation fail as it is just a warning
not a critical error
did you ever fix this? I'm running into same issue
I gues for module options You should use "NodeNext":
Plain Text
{
    "extends": "@apify/tsconfig",
    "compilerOptions": {
        "module": "NodeNext",
        "moduleResolution": "NodeNext",
        "target": "ES2022",
        "outDir": "dist",
        "noUnusedLocals": false,
        "skipLibCheck": true,
        "lib": ["DOM"]
    },
    "include": [
        "./src/**/*"
    ]
}


Otherwise, just update apify-cli to the latest version and regenerate it from the template.
Add a reply
Sign up and join the conversation on Discord