How to install npm package from a python script?
When I use subprocess.Popen(["node", "app.js"])
it is OK.
When I use subprocess.Popen(["npm", "install", "open"])
it is throwing an error.
Sorry, but Google and DuckDuckGo are not my friends today(
The main problem — automatic local installation required packages for my small utility because global packages are not working in windows.
PS. I have to ask this question because I’m trying to develop a plugin for Sublime Text 2.
This is the error in 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 line 16 to subprocess.Popen(["node", "npm", "install", "open"])
then the python script will successfully invoke the nodejs terminal, but then it will fail with error:
cannot find npm module