6363(NODE_MODULES_DIR / '.bin' ).mkdir_p ()
6464
6565
66+ #: The absolute path to the Node.js ``npm`` executable.
67+ NPM = Path (whichcraft .which ('npm' )).realpath ()
68+
69+
6670def install (package ):
6771 """
6872 Install given Node.js `package`.
6973
7074 Into ``node_modules/`` of current Python environment
7175 """
72- command = ['npm' , 'install' , package ]
76+ command = [NPM , 'install' , package ]
7377 with Path (sys .prefix ):
7478 status = zetup .call (command )
7579 if status :
@@ -82,7 +86,7 @@ def uninstall(package):
8286
8387 From ``node_modules/`` of current Python environment
8488 """
85- command = ['npm' , 'uninstall' , package ]
89+ command = [NPM , 'uninstall' , package ]
8690 with Path (sys .prefix ):
8791 status = zetup .call (command )
8892 if status : # pragma: no cover
@@ -112,7 +116,8 @@ def Popen(executable, args=None, **kwargs):
112116 """
113117 import nodely .bin
114118
115- command = nodely .bin [executable ]
119+ command = nodely .bin [ # pylint: disable=unsubscriptable-object
120+ executable ]
116121 return command .Popen (args , ** kwargs )
117122
118123
@@ -128,5 +133,6 @@ def call(executable, args=None, **kwargs):
128133 """
129134 import nodely .bin
130135
131- command = nodely .bin [executable ]
136+ command = nodely .bin [ # pylint: disable=unsubscriptable-object
137+ executable ]
132138 return command .call (args , ** kwargs )
0 commit comments