Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
1

TypeError: require(...) is not a function

hazelpy
hazelpy

When I attempt to use require() in a Nodejs repl, it throws the error in the title. What am I doing wrong?

3 years ago

Voters

Comments

TopNew
2
eco27
eco27

require is not a function because you are trying to call the thing you required like a function example: a = require("a"); a() <- this might throw an error because a itself might not be a function, this is equivalent of putting require("a")()

so the thing you are trying to require might not be a function

3 years ago
Load more