title: How to install npm package from python script?
body: <p>How to install npm package from a python script?</p>
  
  <p><strong>When I use</strong> <code>subprocess.Popen(["node", "app.js"])</code> it is <strong>OK</strong>.<br>
  <strong>When I use</strong> <code>subprocess.Popen(["npm", "install", "open"])</code> it is <strong>throwing an error</strong>.</p>
  
  <p><em>Sorry, but Google and DuckDuckGo are not my friends today(</em></p>
  
  <p><strong>The main problem</strong> — automatic local installation required packages for my small utility because global packages are not working in windows.</p>
  
  <p><strong>PS.</strong> I have to ask this question because I’m trying to develop a plugin for Sublime Text 2. </p>
  
  <p>This is the <strong>error in Sublime python console</strong>:</p>
  
  <pre><code>Reloading plugin …\stsync.py
  Traceback (most recent call last):
    File ".\sublime_plugin.py", line 103, in create_application_commands
      cmds.append(class_())
    File ".\stsync.py", line 16, in __init__
    File ".\subprocess.py", line 633, in __init__
    File ".\subprocess.py", line 842, in _execute_child
  WindowsError: [Error 2] 
  </code></pre>
  
  <p>line 16: <code>subprocess.Popen(["node", "npm", "install", "open"])</code></p>
  
  <hr>
  
  <p><strong>If I change</strong> line 16 to <strong>subprocess.Popen(["node", "npm", "install", "open"])</strong>
  then the python script will successfully invoke the nodejs terminal, but then it will fail with error:<br>
  <code>cannot find npm module</code><br>
  <img src="https://i.stack.imgur.com/qqrZW.png" alt="nodejs error"></p>