title: Is there a pip freeze equivalent for Node and NPM?
body: <p>This is idiomatic in Python:</p>
  
  <pre><code>pip freeze &gt; requirements.txt
  pip install -r requirements.txt
  </code></pre>
  
  <p>The first command saves a list of requirements to a file. Then later you can use the command to install the requirements into your environment.</p>
  
  <p>Node has <code>npm install</code>, but I don't get how to I'm supposed to dump the state of my dependencies to a package.json. I Googled and found <a href="https://gist.github.com/ChimeraCoder/3152820" rel="noreferrer">this</a>: </p>
  
  <pre><code>npm ls | grep -E "^(├|└)─" | cut -d" " -f2 | awk '{FS = "@"; print "\""$1"\"", ":", "\""$2"\""}'
  </code></pre>
  
  <p>but as the author of this pipeline suggests, there's got to be a better way? What am I missing here? </p>
  
  <p>I just want to dump my current deps into a package.json. As <a href="https://npmjs.org/doc/shrinkwrap.html" rel="noreferrer">https://npmjs.org/doc/shrinkwrap.html</a> says, </p>
  
  <blockquote>
    <p>The "package.json" file is still required if you want to use "npm install".</p>
  </blockquote>
  
  <p>I've skimmed the info on <code>shrinkwrap</code>, but I'm not seeing how to simply accomplish this task with <code>shrinkwrap</code>.</p>