Reputation: 18177
I have a project that is multiple node apps, each with their own node_modules
folder:
root
app 1
node_modules
app 2
node_modules
app 3
node_modules
The apps are independent of each other, but do send some data back and forth using socket.io
.
Since there are quite a few shared modules, I was wondering if it was possible to have a node_modules
folder at the root level, that could be shared amongst the apps?
Something like this:
root
node_modules
app 1
app 2
app 3
Upvotes: 0
Views: 44
Reputation: 106696
That should work fine since node looks in parent directories up until the root of the file system when searching for a module.
The only thing you should be careful of is module versions. If different apps depend on different module versions, you'd have to keep those copies of those modules local to the app directory so that it picks up the right module.
Upvotes: 1