How to install a node module locally and globally? How to add them into package.json?

 By default, Node.js installs the module locally in the ./node_modules directory. To install a module globally and to make them available everywhere, we need to include the -g flag.

npm install express -g

To save the installed module to the package.json under dependencies, add --save flag with the package name. To add under deveDependencies add --save-dev.

Comments

Popular posts from this blog

What is a Callback function in Node.js?

What is an Event loop in Node.js and how does it work?