I am trying to setup a simple node/express server and I receive the following error
TypeError: root path required
I would like to know how to fix this error. Thanks
var nodeModulesDir = process.env.NODE_MODULES_DIR,
app.use(express.static(publicDir));
app.use("/node_modules", express.static(nodeModulesDir)); // ERROR AT THIS LINE
app.post("/uploads", onUpload);
app.delete("/uploads/:uuid", onDeleteFile);
Tryout this way
app.use(express.static(__dirname + '/public'));
i mean use __dirname for get from main root path .
modify .bash_profile add export NODE_MODULES_DIR=GGGGGGGGGGG

BTW, Don't forget restart the server!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With