Ask coding questions

← Back to all posts
Inside a Nodejs project, Repl doesn't recognize the "require" keyword.
GIUSEPPEFERRI (1)

Hi guys, if I create a .ts file inside a Nodejs Project, Repl doesn't recognize the require keyword. There is a solution?

I know the TypeScript Project, but I have to use a Nodejs Project.

Comments
hotnewtop
xfinnbar (22)

Use a typescript repl if you are using Typescript. It runs node.js and has TSC installed. It will automatically compile all typescript files at runtime.

EpicGamer007 (1644)

You can try es modules instead.

GIUSEPPEFERRI (1)

"I know the TypeScript Project, but I have to use a Nodejs Project." @EpicGamer007

EpicGamer007 (1644)

@GIUSEPPEFERRI hm.. then i am not sure, sorry. report it to bugs. Link this post and make sure to include images as well

ch1ck3n (1632)

try not using typescript but normal javascript .js

GIUSEPPEFERRI (1)

I know that .js files work in a Nodejs project, but I have to use a .ts file inside a Nodejs project. @ch1ck3n