Skip to content

Commit 4780a39

Browse files
committed
Use subprocess shell to get npm global prefix.
This is necessary to prevent failure on Windows.
1 parent 0d507c6 commit 4780a39

File tree

1 file changed

+4
-2
lines changed
  • python_packages/jupyter_lsp/jupyter_lsp

1 file changed

+4
-2
lines changed

python_packages/jupyter_lsp/jupyter_lsp/types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,9 @@ def _default_nodejs(self):
236236
def _npm_prefix(self):
237237
try:
238238
return (
239-
subprocess.run(["npm", "prefix", "-g"], check=True, capture_output=True)
239+
subprocess.run(
240+
["npm prefix -g"], check=True, capture_output=True, shell=True
241+
)
240242
.stdout.decode("utf-8")
241243
.strip()
242244
)
@@ -274,7 +276,7 @@ def _default_node_roots(self):
274276
if shutil.which("npm"):
275277
prefix = self._npm_prefix()
276278
if prefix:
277-
roots += [pathlib.Path(prefix) / "lib"]
279+
roots += [pathlib.Path(prefix) / "lib", pathlib.Path(prefix)]
278280

279281
return roots
280282

0 commit comments

Comments
 (0)