Fallback to module installs if package.json is missing in a local
folder

Fixes #6117
Add tests for local fallback to registry patch
make #6119 compatible with #5629
style tweaks: semicolons, spacing, ' -> "