require() in nodejs not working
So I tried requiring a file by using the require() function. I have a file named 'db.js' and tried to require it by typing out require("./db.js") but it said "Cannot find module './db.js'
timmy_i_chen (1151)
Do you have a repl link we can look at?
SirDerpyHerp (2)
@timmy_i_chen Sorry for the late response, but here it is: https://repl.it/@SirDerpyHerp/Testing
timmy_i_chen (1151)
@SirDerpyHerp Ah I think you can only require JS files, so the JSON file would have to be loaded through the fs
package or something.
I have the same issue. Something simple like lo = require('lodash') doesn't work anymore. It used to.