litmis Install node-repl on IBM i in non-global fashion

Created by Aaron Bartell

| | | - | - | - | - IBM i Hosting | Cybersource Toolkit for i | RPG-XML Suite | Payment Terminal Toolkit for i | UPS Toolkit for i

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

Now install node-repl.

$ npm install node-repl
`-- node-repl@2.0.2
  `-- strip-bom@1.0.0
    +-- first-chunk-stream@1.0.0
    `-- is-utf8@0.2.1

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.

Now invoke bin.js in qualified fashion and include additional parms per the npm's documentation.

$ node_modules/node-repl/bin.js app.js

Comments (0)


You can clone a snippet to your computer for local editing. Learn more.