How To Require Node Module In Node REPL Without Installing Globally?

Your require statement is working fine. Ignore the undefined, that’s just the node REPL. The undefined is explained here, and see the comments below for links to additional material about that.

You can verify with:

mkdir /tmp/test-repl
cd /tmp/test-repl
npm install express
node
> var express = require('express');
undefined
> express
//long object which is the express module gets printed

Leave a Comment