How to install npm package from python script?
When I use subprocess.Popen(["node", "app.js"]) , it is OK .
When I use subprocess.Popen(["npm", "install", "open"]) , it throws an error .
Sorry, Google and DuckDuckGo are not my friends today (
The main problem is automatic local installation requires packages for my small utility, because global packages do not work on Windows.
PS. I need to ask this question because I'm trying to develop a plugin for Sublime Text 2.
This is the error in the Sublime python console :
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]
line 16: subprocess.Popen(["node", "npm", "install", "open"])
If I change 16 lines to the .Popen subprocess (["node", "npm", "install", "open"]) then the python script will successfully call the nodejs terminal, but then the nodejs terminal will fail:
cannot find npm module

Vladimir Starkov
source share