Actually, it is taking the reference of previously stored modules.
Solution:Delete the npm-cache/npm folder in the installation directory of nodejs. In windows, it is in C:/User/Username/Appdata/Roaming/npm(or npm_cache). and try to install again.
Same thing to do in any OS.