How to install node.js
How to install node.js step by step
Download NodeJs and install.
File Name :
Run the installation
Double click on the downloaded .msi file to start the installation.
Click the Run button on the first screen to begin the installation.
Run the installation
Double click on the downloaded .msi file to start the installation.
Click the Run button on the first screen to begin the installation.
Check NodeJs Version.
File Name :
node -v
Or
node --version
what is npm?
File Name :
NPM is a package manager for Node. js packages, or modules
A package in Node.js contains all the files you need for a module.
Modules are JavaScript libraries you can include in your project.
Node Package Manager (NPM) provides two main functionalities .
Online repositories for node.js packages/modules which are searchable on search.nodejs.org
Command line utility to install Node.js packages, do version management and dependency management of Node.js packages.
File Name :
npm --version
Open the command line interface and tell NPM to download the package you want.
C:\Users\mahtab>npm install upper-case
Installing Modules using npm
npm install <Module Name>
Open the Node.js command prompt and execute the following command:
npm install express
npm ls
Globally install
Globally installed packages/dependencies are stored in system directory. Let's install express module using global installation. Although it will also produce the same result but modules will be installed globally.
Uninstalling a Module
Searching a Module
Node.js Console/REPL
Node.js comes with virtual environment called REPL. REPL stands for Read-Eval-Print-Loop. It is a quick and easy way to test simple Node.js/JavaScript code.
To launch the REPL, open command prompt (in Windows) or terminal (in Mac or UNIX/Linux) and type node as shown below. It will change the prompt to > in Windows and MAC.
You can now test pretty much any Node.js/JavaScript expression in REPL. 10 + 20 will display 30 immediately in new line.
The + operator also concatenates strings as in browser's JavaScript.
REPL Command :- Description
.help :- Display help on all the commands
tab Keys :- Display the list of all commands.
Up/Down Keys :- See previous commands applied in REPL.
.save filename :- Save current Node REPL session to a file.
.load :- filename Load the specified file in the current Node REPL session.
ctrl + c :- Terminate the current command.
ctrl + c (twice) :- Exit from the REPL.
ctrl + d :- Exit from the REPL.
.break :- Exit from multiline expression.
.clear :- Exit from multiline expression.
Previous
Next