We help IT Professionals succeed at work.

Specify configs in the ini-formatted file (node.js)

Bruce Gust
Bruce Gust used Ask the Experts™
New to Node.js, but getting more comfortable with it every day.

Ah, but wait...

We got a note today from the boss that we need to head out to a repository, download the codebase and start looking it over.

So I clone the repository and this is what I have on my local box:

I'm assuming that "PRAMS" is kind of like a suitcase for a Node.js application based on what I see here: https://www.npmjs.com/package/pram

...but I would like some confirmation on that.

Next, I follow my nose and I copy and paste the contents of the PRAMS directory to that place where I can fire it up on my local box.

But what port is it going to be firing on?

I run npm index.us and I get this:

Usage: npm <command>

where <command> is one of:
    access, adduser, audit, bin, bugs, c, cache, ci, cit,
    clean-install, clean-install-test, completion, config,
    create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
    edit, explore, get, help, help-search, hook, i, init,
    install, install-ci-test, install-test, it, link, list, ln,
    login, logout, ls, org, outdated, owner, pack, ping, prefix,
    profile, prune, publish, rb, rebuild, repo, restart, root,
    run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, team, test, token, tst, un,
    uninstall, unpublish, unstar, up, update, v, version, view,

npm <command> -h  quick help on <command>
npm -l            display full usage info
npm help <term>   search for help on <term>
npm help npm      involved overview

Specify configs in the ini-formatted file:
or on the command line via: npm <command> --key value
[b]Config info can be viewed via: npm help config[/b]

npm@6.12.1 C:\Program Files\nodejs\node_modules\npm

Open in new window

What am I missing and what do I need to do to get the app to run on my local box?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2018
Distinguished Expert 2018
Hey Bruce,

Not entirely sure you've linked to the correct NPM package. The one you've linked to is just a library to handle Parameters - it's not an application. You install it to your own application using npm install pram. All that does is install the library into your node_modules folder. It's up to you to then use that in your own application.

As for the npm index.us, npm is the node package manager - you use it by calling npm command [args]. The message you're getting is just telling you that index.us is not an npm command, and then it goes on to show you the valid commands. For example, to run your application, you normally call something like this:

npm run dev

run is the command and dev is the argument - in this case, dev is the name of one of your scripts from your application's package.json file.
Bruce GustPHP Developer


Chris, I want you to see this because, apparently, while PRAMS is the name of the folder, perhaps it wasn't a wise choice for a name given the fact that it is a Node.js term that can lead a newbie down a rabbit trail if they're not careful.

Here's a screenshot of the PRAMS folder:

screenshot of PRAMS
That doesn't look like something you would put into a "node_modules" directory.

What do you think?
Most Valuable Expert 2018
Distinguished Expert 2018
Hmmm. No it doesn't. The PRAM package that you linked to in your post is an NPM package, and you install those with npm install package-name. That adds the package to your node_modules folder, so I'm guessing that the link you provided is not for the PRAMS package you're talking about. If I run npm install pram, I get a new folder called pram in my node-modules and the contents look nothing like your screenshot - it's just a small JS library.

From the screen shot you've provided, it looks like a complete app. You said in your original post that you cloned a repo, so maybe provide us with a link to the repo (Github / BitBucket, I'm guessing!).

Having said that, with an app like this, you usually launch it by running npm run scriptname from the root folder. If you look inside the package.json file, you'll see a property called scripts. This property will have a series of other properties that are the names of the scripts available to you, such as dev, build, test etc. Just run the one that's most suitable. Generally speaking, you'll have a dev script that will build your app and launch it in a browser (it could be called anything - launch, dev-server etc). You will likely also have a build script - you tend to run this when you need to compile the finished app to upload to a production server.
Bruce GustPHP Developer


Chris, punt the last comment!

PRAMS was a poor choice as far as nomenclature is concerned. If you cd into the PRAMS directory and do an npm install, you're good to go.

Now, you still have to assign a PORT, but when you do, "it is alive."

I'm still not out of the woods yet, however. If you want to head to https://www.experts-exchange.com/questions/29169495/UnhandledPromiseRejectionWarning-MongoError-not-authorized-on-test-to-execute-command-What-the-smoke.html,  I would appreciate your input.
Bruce GustPHP Developer


Always appreciated, Chris!