ALSO READ : Pass command line arguments in NodeJS
Now in this post we will show you how to change the default configuration file for all the packages to be installed in your current project.
Usually to install modules mentioned on package.json we use the command "npm install". This command acts the same ways as installing on the command-line. The version of the packages will be depends of what is specified in package.json, if nothing is defined it will install the latest version.
But sometimes you want to change the config settings from the command line, thus you can specify which configuration file to pick when you will be installing the packages. This can be done using the userconfig command line flags as shown below :
npm --userconfig=./.npmrcnew install
Which will install the modules as mentioned in package.json while considering the configuration file supplied by the --userconfig argument. You can either write i or install to install the packages.
ALSO READ : Get Call Stack Information in NodeJS
Please Like and Share the CodingDefined Blog, if you find it interesting and helpful.