How to use NodeJs Module using Command Line Interface (CLI)?

In this code snippet, we will discuss how we can use Nodejs module using npm cli (Command line interface). We will discuss bit about CLI. Firstly, we will get the nodejs module and then start using it.


In this code snippet, we will discuss how we can use Nodejs module using npm cli (Command line interface).

What is CLI?

First fo all lets us discuss what is CLI?
So, CLI is nothing but Command Line Inteface. An inteface for user to interact either with Operating System or directly with associated application.

Here, we will use npm cli in our code snippet.

Talking about code

Lets directly talk about our NodeJs module. In our current code-snippet we are not going to develop any new Nodejs module, although we will use an existing one. Detailing for NPM CLI, Nodejs is beyond the scope.

Follow these steps to get existing Nodejs modules

  • Go to NPM Package repository: to check documentations

  • Open Command prompt normal command prompt or you can use Powershell or Gitbash (if installed).

  • Write following and hit enter:
    npm install number2text

    npm install number2text --save

Please note that if you do not have Nodejs installed on your system, you need to install one.

Now you're ready to use the package. Use following code snippet:

Initiate node:


Create object:

var numberToText = require('number2text');

Use public methods/functions:

var textDefault = numberToText(100);

Check the output:

console.log('Converts 1000000 to ', textDefault);

All thats it, we've done with it :)


In this code-snippet, we discussed how to use existing Nodejs modules using npm CLI.

Article by Gaurav Aroraa
Gaurav is a Microsoft Technology Specialist professional. He has awarded lifetime membership from Computer Society of India (CSI). He has more than 13yrs of experience in the industry. Currently, he is working in the capacity of Solution Architect with an MNC. He is serving to the various communities since 1999.

Follow Gaurav Aroraa or read 149 articles authored by Gaurav Aroraa


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: