Top nodejs node and npm command line tools tutorials

Basics of Nodejs Server

Nodejs is server platform for deploying web applications using java script. Nodejs server is very famous in current industry for asynchronous request processing We can use nodejs for streaming based applications. NodeJS is free and opensource application to develop server side applications
Nodejs is popular because of event driven and modularity based architecture

Nodejs installation comes node and node packaging manager (NPM) tools

How to find out nodejs server version in command line?

Nodejs version can be found using node command line tool. Node command displays the output to console as shown below node command with option -v or --version. node with option -v does not worked, use node with --version command

A:\nodework>node --version


A:\nodework>node -v

How to display out npm  tool version of nodejs server in command line?

npm version can be found using npm command line tool. npm reports result to console as shown below

Npm version will be showing using -v option or --version

A:\nodework>npm --version

A:\nodework>npm -v

How to get nodejs v8 server engine version in command line?

Nodejs built with google v8  javascript server engine. This is main engine for event driven feature. This is developed by google chrome team. V8 server engine basically compiles javascript code to native machine code. V8 code can be executed in browser as well as independent applications. V8  also used in monogdb

A:\nodework>node -p process.versions.v8

How to install packages/dependencies in nodejs environment?

Nodejs is popular for managing different  modules and packages. Npm install is usted to install to install packaeges
npm packages can be installed locally or globally. Based on the need of the requirement, We can go in anyway

how to do npm package install locally?

npm command install the packages locally by default. Npm install command copy the package contents to node_modules folder. To test whether package installed or not, Check packagename folder exists under node_module folder and make sure that packagename.json exists
npm install packagename

how to do npm package install globally?

npm command uses -g option to install package globally. package name contents shared under nodejs node_modules folder

npm install -g packagename

how to add packages using npm install --save option?

packages dependencies are not added to default under package.json in your application. with using --save option, depndencies are added to package.json under application code
npm install  packagename --save

and the output will be like the below content in package.json


That's all basic nodejs commands. Please comment and share this post if you liked it.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.