I am starting a new project on replit for the first time. Its a very basic scraper. I already have it working in VSCode but can’t work out how to get going in replit - would love some help! This is the error I get when i try to run my code:
Error: Cannot find module ‘/home/runner/scraper/index.js’
Require stack:
- /nix/store/29fdcv1yhlll61ml8a31qdkrbprxd7gs-prybar-nodejs-0.0.0-67f7a00/prybar_assets/nodejs/module-context-hook.js
- /tmp/prybar-nodejs-3321562800.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.resolve (node:internal/modules/cjs/helpers:109:19)
I added a tsconfig.json file, here it is:
{
“compilerOptions”: {
“target”: “es2021”,
“module”: “commonjs”,
“lib”: [“es2021”,“dom”],
“esModuleInterop”: true,
“moduleResolution”: “node”,
“experimentalDecorators”: true,
“noImplicitAny”: false,
“outDir”: “./build”,
“baseUrl”: “./src”,
“allowUnreachableCode”: true,
“sourceMap”: true,
“skipLibCheck”: true
},
“include”: [“src/*/”],
“exclude”: [“node_modules”]
}
I have one index.ts file inside an SRC folder and thats it.
Link here - https://replit.com/@drninja777/ThorsScraper?v=1
Thanks!
Hey, @drninja777 welcome to the forums!
Can you please provide a link to the repl?
1 Like
My post was marked as spam but its back now. Thanks for the help.
That repl doesn’t appear to exist. Is it private?
Sorry you are right - made it public
1 Like
Node repls run from index.js
by default. You should change the entrypoint
field in the .replit
file to src/index.ts
Also, if you’re planning on using TS, I’d suggest using the TypeScript template
Thanks! Um…where is my .replit file?
Sorry v new to this!
Oops sorry, should have said! You need to click the three dots at the top of the flietree and then select show hidden files.
1 Like
Replit wont let me post another link here for some reason.
I tried again with the ts template you found but still cant get anything to run - maybe i should stick to VScode!
If you know of any typescript + pupeteer templates I would love to take a look. Might post a bounty for one in a bit if i cant work it out. Thanks for the help!
@drninja777 please stop sharing join links. It makes it so anybody can delete all your code. Instead please share a link to the cover page of the repl.
Looks like running the code is working but you have a bug in the code. This is now supposed to be in code help.