Fixed version-check logic for already-installed npm packages

This fixes installing a new version of an already-installed package.
Merge pull request #15235 from whiteinge/npm-updated-existing-install

Fixed version-check logic for already-installed npm packages