Recent versions of npm appear to have changed the way they manage git-based dependencies. In the past, if we declared a dependency in package.json like this:
npm would be smart enough to match other modules' need for the same version of Infusion and only install it once. With npm 1.3.21 and 1.3.22, I have noticed that this is no longer the case. npm is installing multiple copies of the same dependency.
I haven't yet tracked down when or why this changed in npm.
The result of this issue is that two copies of Infusion end up getting instantiated at run time. Kettle, as a result, gets its own separate instance of Infusion from universal. This means that Kettle never properly loads itself globally and as a result can't be used.
The error I encounter when I try to run an instance of the Flow Manager with this bug in place is:
"Cannot autoInit component gpii.matchMaker which does not have an initFunction and gradeNames defined"
This is due to the fact that the kettle.app grades aren't available to be properly mixed into gpii.matchMaker.
A temporary workaround for this is to delete Kettle's copy of Infusion:
rm -rf gpii/node_modules/universal/node_modules/kettle/node_modules/infusion
We need to:
1. Determine if there is a "correct" way of using git-based dependencies with npm that we are unaware of
2. If not, create a simplified example and file a bug with the npm folks
3. If that doesn't work, consider writing our own "clean up" script that will walk the tree of node_modules dependencies and remove duplicate copies of shared resources such as Infusion.