How to install and run node.js:
The first step is installing node. You can start building node application on any platform!
You can download NodeJs from the following URL: https://nodejs.org/en/download/
During this Blog creation version details:
Latest LTS Version: v6.11.0 (includes npm 3.10.10)
Latest version: v8.6.0
LTS: Long Term Support.
Based on your processor size, you can install the Node on your machine. It is good to prefer the latest LTS version of node.
☝☝Question: How I can verify whether the node installed?
If you are using windows, Open command prompt and type node -v. Then you will get latest version information of the node installed. if you are Mac or Linux user try the same command in your terminal.
☝☝Question: Installation completed successfully but node -v not working?
You need to add C:\Program Files\nodejs(nodejs installation directory it may differ) your PATH environment variable. To do this follow these steps:
- Use the global Search Charm to search “Environment Variables”
- Click “Edit system environment variables”
- Click “Environment Variables” in the dialog.
- In the “System Variables” box, search for Path and edit it to include C:\Program Files\nodejs. Make sure it is separated from any other paths by a ;.
You will have to restart any currently-opened command prompts before it will take effect.
It holds good for mac, and linux, Set PATH command needs to be executed.
☝☝Question: Do I need to install npm? where I can find npm?
No, You don’t need to install npm separately. It will be installed during the installation of NodeJS. You can verify it by running npm -v in command prompt. If it fails then you need to check the PATH Environment variable.
What is npm?
Definition for npm as mentioned in npmjs.org is
I believe above definition is not enough to understand about npm. Let me explain about npm in simple terms.
npm is used to maintain dependencies of the node application. It is something similar to Maven for Java.
Once you start using npm in your application you can able to understand why and how it is used.
Please share your comments or questions in the below comment section!!??