Skip to content

Commit 21b4c7e

Browse files
Use absolute path of npm executable
1 parent 6e6780e commit 21b4c7e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

nodely/__init__.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,17 @@
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+
6670
def 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

Comments
 (0)