Aleksandrenko
Aleksandrenko

Reputation: 3065

Running npm command from expressjs?

Can i run something like: npm install passport from expressjs itself?

I want to check if i'm using a non installed module and install it before running the application.

Upvotes: 0

Views: 346

Answers (1)

krg
krg

Reputation: 2790

To answer your question, yes, you should be able to check the FileSystem for specific files/folders using fs. I imagine you would need to parse your package.json and check the local node_modules or the global install path.

I would recommend a shell script to run npm install and then fire up your app from within the same script.

npm install .
node <server> &

Upvotes: 1

Related Questions