title: Best way to pass a flag to Node.js depending on Node version?
body: <p>When Node.js is <code>&gt;6.3</code> I need to pass <code>--preserve-symlinks</code>.</p>
  
  <p>I have about 50+ modules that have a <code>package.json</code> like so:</p>
  
  <pre><code>"scripts": {
    "gulp": "./node_modules/gulp/bin/gulp.js",
    "start": "node main/server.js"
  },
  </code></pre>
  
  <p>What is the best way to do this? If the flag is turned on my default some day I will need to update this too.</p>
  
  <p>I am thinking that I will need to abandon npm run-scripts in this case and just have a single script which will determine the version to use.</p>
  
  <hr>
  
  <p>Similar question: <a href="https://superuser.com/questions/691133/always-run-node-with-the-harmony-flag">https://superuser.com/questions/691133/always-run-node-with-the-harmony-flag</a></p>
  
  <p>PM2 has a <code>node_args</code> option: <a href="https://futurestud.io/blog/pm2-how-to-start-your-app-with-node-js-v8-arguments" rel="nofollow noreferrer">https://futurestud.io/blog/pm2-how-to-start-your-app-with-node-js-v8-arguments</a></p>