use npm packaged mongoose-Collection of common programming errors

In order to “modularize” a project, I created several npm packages, but I get an error in two modules that use mongoose.

The first one regroups several operation over the db such connection, map/reduces, or DAO. The second one regroups all my mongoose model. My packages are stored in /packages.

I am using npm link in /packages in all those packages to be able to modify them easily.

Right after connecting mongoose here what i get if i do : console.log(‘mongoose’)

...
replica: false,
hosts: null,
host: 'localhost',
port: 27017,
user: undefined,
pass: undefined,
name: 'myCollection',
...

So mongoose if properly configured.

But in my model’s package if I do: console.log('mongoose) I get:

...
replica: null,
hosts: null,
host: null,
port: null,
user: null,
pass: null,
name: null,
...

So when I try to find any of my model, I never get an answer (normal mongoose don’t know where to search).

I figured out that if I remove all the node_module in all packages in /packages it works, but i lost all my dependencies (those I use only in package but not in the main project.)

Does someone have a clue how to solve this problem?

Originally posted 2013-11-09 23:11:59.