Install node-repl on IBM i in non-global fashion
This micro tutorial will show how to install the
node-repl npm in a non-global fashion (in case you don't want it global), and how to subsequetly invoke it.
First create a directory we can work in and make sure we're using a recent version of Node.js (v6.9.1 as of this writing).
$ mkdir node-repl $ cd node-repl $ export PATH=/QOpenSys/QIBM/ProdData/OPS/Node6/bin:$PATH
$ npm install node-repl /home/aaron/node-repl `-- email@example.com `-- firstname.lastname@example.org +-- email@example.com `-- firstname.lastname@example.org npm WARN enoent ENOENT: no such file or directory, open '/home/aaron/node-repl/package.json' npm WARN node-repl No description npm WARN node-repl No repository field. npm WARN node-repl No README data npm WARN node-repl No license field.
Create a small Node.js application.
$ echo "console.log('hi');" > app.js
Next we need to find the entry-point program of the
node-repl npm. There are many different ways npms structure their folder structure and also how they name their entry-point program. You always start looking in
node_modules/<name-of-npm> and search for something that looks like an entry-point program, in this case
bin.js in qualified fashion and include additional parms per the npm's documentation.
$ node_modules/node-repl/bin.js app.js hi
You can clone a snippet to your computer for local editing. Learn more.