NPM Init Command
Always try to start a project with npm init this will ask you some options then it will create a new package.json file into your projects. so whenever we install a new module with –save or –save-dev flag it will make an entry to package.json file. whenever we install a new package that will create a new node_modules folder into your project. by using package.json file we don’t need to move all modules from one environment to another we just need to carry our package.json file and whenever we need packages we just need to run npm install or npm i , this command will automatically read the package.json file and download all packages to local machine or on server.
Now no need to push all node modules into git and make it heavy we just need to push package.json into git and on another machine just run npm i to install packages.