This is what worked for me.
- Open a local folder other than the one in which nodejs is installed.
- Install npm in that folder with command
npm install npm
- Navigate to the folder containing node js. (C:\Program Files\nodejs\node_modules)
- Delete the npm folder and replace it with the npm and bin folders in the local folder.
- Run
npm -v. Now you would get updated version for npm.
Note: I tried installing npm directly in "C:\Program Files\nodejs\node_modules" but it created errors.