Installing NodeJS

1)Download node.js(.msi file)
2)Install node.js from node js website. NPM is installed as part of the installation.
3)Run node.js application / run git bash/ run command line
4)Check node command working on all of the above
5)If node command doesn’t work on git bash, set the path using the following
a.export PATH=$PATH:”C:\Program Files\nodejs”
b.unix style path
6)If node command doesn’t work on command line, set the path using the following
a.SET PATH=C:/Program Files/nodejs;%PATH%
7)Nodejs runs on the same java script engine as the chrome which is V8 Javascript engine.
8)With Node you have to write the webserver unlike PHP where you just install and use, here at node you have to write the webserver.

Testing Node Installation:

  1. Open command prompt and type in “node -v” to see the node version
  2. alternatively you can open node.js and type in “process.version”
  3. If you have opened command prompt and typed in ‘node’ and pressed Enter then you need to type in “process.version” to know the version of node

Test NPM installation:

  1. Make sure ‘%AppData%/npm’ is added to the path variable. Add it if it is not already added
  2. create a node-test folder
  3. Go to the folder on command prompt
  4. Type in command ‘npm init’ which creates package.json file for your project
  5. If the command doesn’t work, it means you haven’t set the path correct. Check point 1 and set your path variable right.
  6. Install a sample package by typing the command “npm install lodash”

 

 

Advertisements