“Cannot find module” when running unit tests on node.js with react as peer dependency in common package
问题 I have following app structure: Application A Application B Common package Now Application A and B have in package.json the common package added: { dependencies: { "commonPackage": "file:../../../commonPackage" } } both apps use React, as well as the common package, all had React added with npm , and it worked, before we started to use react hooks. Because when we started, we got an Invalid Hook Call Warning due to having "more than one copy of React", so to avoid that, in the common package,