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%
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:
- Open command prompt and type in “node -v” to see the node version
- alternatively you can open node.js and type in “process.version”
- 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:
- Make sure ‘%AppData%/npm’ is added to the path variable. Add it if it is not already added
- create a node-test folder
- Go to the folder on command prompt
- Type in command ‘npm init’ which creates package.json file for your project
- If the command doesn’t work, it means you haven’t set the path correct. Check point 1 and set your path variable right.
- Install a sample package by typing the command “npm install lodash”