title: How do I get the ‘program name’ (invocation location) in Node.js?
body: <p>I want the equivalent of $PROGRAM_NAME in Ruby, or ARGV[0] in C-likes, for Node.js. When I have a Node script that looks something like this,</p>
  
  <pre><code>#!/usr/bin/env node
  console.log(process.argv[0])
  </code></pre>
  
  <p>… I get “node” instead of the name of the file that code is saved in. How do I get around this?</p>