Best practice for nodejs deployment - Directly moving node_modules to server or run npm install command : <p>What is the best practice for deploying a nodejs application?</p>

<p>1) Directly moving the node_modules folders from the development server to production server, so that our same local environment can be created in the production also. Whatever changes made to any of the node modules remotely will not affect our code.</p>

<p>2) Run <code>npm install</code> command in the production server with the help of package.json. Here the problem is, any changes in the node modules will affect our code. I have faced some issues with the loopback module (<a href="https://stackoverflow.com/questions/50683224/loopback-getting-error-major-change-in-user-validatepassword-function-in-the-s">issue link</a>). </p>

<p>Can anyone help me?</p>
