This question has been archived.

npm module dependencies not getting installed.

July 9, 2015 2.4k views
Node.js MEAN

I am using a mac (ssh as the root user for all commands), MEAN stack (using Yeoman angular-fullstack generator), my droplet is configured with the MEAN stack application and finally, I am using this guide to deploy my application -

The guide contains two scripts to be executed locally (deploy) and on the server (setup). They basically configure git post-receive (you can see the details in the link above).

The problem that I am facing is that once the distribution files are being uploaded to the server, only top level node modules are being installed. i.e., if the package.json file contains mongoose as a dependency, then only mongoose is being installed but it's dependencies (eg. mongodb) aren't getting installed.

I have tried removing the node_modules folder and reinstalling using npm install and sudo npm install, however I keep coming across the same problem.

The modules aren't being found regardless of what I am using to launch the server as well - pm2, node, grunt.

Here is an example of the error message I get -

    throw err;
Error: Cannot find module './schema'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/root/noctrn/node_modules/mongoose/lib/index.js:7:14)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)

Thank you for taking the time to read this.

1 comment
Be the first one to answer this question.