temp: float patch on npm-registry-mock devdep for optimist
Handle circular dep installs properly

Check that the current directory is require-able: the parent is
node_modules and the package.json's name matches the directory name.

Fix #4312