I've been working on an Angular project with multiple private libraries. Each library was set up in it's own workspace with it's own infrastructure and published to a private artifactory npm registry.

Everything ran fine from the main app at runtime and everything was going great.

That is until one library added a dependency to another library. The app worked fine, but testing was completely borked. I was seeing a lot of errors like this:

Module not found: Error: Can't resolve './browser' in '[absolute path to my repo]/src' resolve '' in '[absolute path to my repo]/src' ... more setuff Field 'browser' doesn't contain a valid alias configuration

I was pounding my head on a desk, because I had no idea what browser was, and and a lot of posts seemed to be indicate this was some type of import error. But, nowhere am I importing or using, or creating, a library named browser.

Turns out, that my internal library was ambigiously named, ui-utilities. And instead of installing the library from my private artifactory I installed a public library. The app compiled because the library was set up as a peer dependency, but the tests failed because it was trying to pull classes out the wrong lib.

The solution was to add a `.npmrc`file into the library root that pointed to the private artifactory instead of the default, public one:

view plain print about

Then I was just able to uninstall the old repo, and re-install it. Finally everything worked.