I have a file server.js in which I am starting multiple servers. eg.
var engine = require('engine.io');
var server = engine.listen(80);
And if the engineio module is not installed in the current directory by using the
npm install engine.io
It throws an error
Error: Cannot find module 'engine.io'
Now on a machine where this server has to be deployed I want handle all these npm module installation dependencies from the script file itself.
How can i do this from my server.js file only
UPDATE
As suggested i tried following the post
Can I install a NPM package from javascript running in Node.js?
but it throws an error when it searches for a node module "npm"
at :
var npm = require("npm");
Reason : i dont have the node modules installed on my machine. ( and so its not having node_modules folder in my working directory)
Also,
I created a batch file in my working directory and put the following into it
npm install engine.io
npm install eyes
And when i run it,
It only installs the first module and then exits
Thanks