Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Put our downloaded copy of Node in the env for every NPM action

Julia2d8159998d03
diff --git a/crates/node_runtime/src/node_runtime.rs b/crates/node_runtime/src/node_runtime.rs
index de9cf501ac7..94858df880e 100644
--- a/crates/node_runtime/src/node_runtime.rs
+++ b/crates/node_runtime/src/node_runtime.rs
@@ -62,6 +62,14 @@ impl NodeRuntime {
args: &[&str],
) -> Result<Output> {
let attempt = |installation_path: PathBuf| async move {
+ let mut env_path = installation_path.join("bin").into_os_string();
+ if let Some(existing_path) = std::env::var_os("PATH") {
+ if !existing_path.is_empty() {
+ env_path.push(":");
+ env_path.push(&existing_path);
+ }
+ }
+
let node_binary = installation_path.join("bin/node");
let npm_file = installation_path.join("bin/npm");
@@ -74,6 +82,7 @@ impl NodeRuntime {
}
let mut command = Command::new(node_binary);
+ command.env("PATH", env_path);
command.arg(npm_file).arg(subcommand).args(args);
if let Some(directory) = directory {