A quick solution from the internet search was npm config set strict-ssl false
, luckily it worked. But as a part of my work environment, I am restricted to set the strict-ssl flag to false.
Later I found a safe and working solution,
npm config set registry http://registry.npmjs.org/
this worked perfectly and I got a success message Happy Hacking!
by not setting the strict-ssl flag to false.