NPM doesn't install module dependencies

Solution 1:

It looks like you hit a bug that has existed for quite a while and doesn't have solution yet. There are several open issues for this case in the npm repository:

  • npm install should recursively check/install dependencies https://github.com/npm/npm/issues/1341 (closed)
  • local private module dependencies https://github.com/npm/npm/issues/2442 (closed)

In the first one people list several workarounds that you may try.

An alternative solution may be (a little hackish) to explicitly list the dependencies as first level dependents. This requires you to maintain the list but practically it has to be done very infrequently.

Solution 2:

I had very similar issue, removing entire node_modules folder and re-installing worked for me. Learned this trick from the IT Crowd show!

rm -rf node_modules
npm install