Resolve npm path and fnm path on Windows (#2015)
This commit is contained in:
parent
d00425276d
commit
91bbf91c52
@ -96,7 +96,7 @@ def get_install_package_manager() -> str | None:
|
|||||||
"""
|
"""
|
||||||
# On Windows, we use npm instead of bun.
|
# On Windows, we use npm instead of bun.
|
||||||
if constants.IS_WINDOWS:
|
if constants.IS_WINDOWS:
|
||||||
return path_ops.get_npm_path()
|
return get_package_manager()
|
||||||
|
|
||||||
# On other platforms, we use bun.
|
# On other platforms, we use bun.
|
||||||
return get_config().bun_path
|
return get_config().bun_path
|
||||||
@ -109,7 +109,10 @@ def get_package_manager() -> str | None:
|
|||||||
Returns:
|
Returns:
|
||||||
The path to the package manager.
|
The path to the package manager.
|
||||||
"""
|
"""
|
||||||
return path_ops.get_npm_path()
|
npm_path = path_ops.get_npm_path()
|
||||||
|
if npm_path is not None:
|
||||||
|
npm_path = str(Path(npm_path).resolve())
|
||||||
|
return npm_path
|
||||||
|
|
||||||
|
|
||||||
def get_app(reload: bool = False) -> ModuleType:
|
def get_app(reload: bool = False) -> ModuleType:
|
||||||
@ -424,11 +427,13 @@ def install_node():
|
|||||||
|
|
||||||
if constants.IS_WINDOWS:
|
if constants.IS_WINDOWS:
|
||||||
# Install node
|
# Install node
|
||||||
|
fnm_exe = Path(constants.Fnm.EXE).resolve()
|
||||||
|
fnm_dir = Path(constants.Fnm.DIR).resolve()
|
||||||
process = processes.new_process(
|
process = processes.new_process(
|
||||||
[
|
[
|
||||||
"powershell",
|
"powershell",
|
||||||
"-Command",
|
"-Command",
|
||||||
f'& "{constants.Fnm.EXE}" install {constants.Node.VERSION} --fnm-dir "{constants.Fnm.DIR}"',
|
f'& "{fnm_exe}" install {constants.Node.VERSION} --fnm-dir "{fnm_dir}"',
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
else: # All other platforms (Linux, MacOS).
|
else: # All other platforms (Linux, MacOS).
|
||||||
|
Loading…
Reference in New Issue
Block a user