0

I am creating a CMS with node.js and express.js. I am creating my app.js file and would like to know how to install certain dependencies globally, to avoid having the user install these modules on their own. For instance. The app requires nodemon and the express-generator modules. Those should be installed globally.

Is there a way for me to install these dependencies globally either via the dependencies area or via the scripts area ?

Thank you in advance.

Ryan Watts
  • 611
  • 1
  • 9
  • 27

1 Answers1

0

Thanks to Ahmad Hasan Khan, I was able to find the solution to my question.

Within the scripts area of your package.json your code should like like this.

"scripts": {
    "start": "node app.js",
    "preinstall" : "npm -g nodemon"
},

Reference Install dependencies globally and locally using package.json

Community
  • 1
  • 1
Ryan Watts
  • 611
  • 1
  • 9
  • 27