Compare commits

...

1 Commits

Author SHA1 Message Date
Thorsten Ball
2e3d25b1e0 node runtime: Fix node not being added to PATH 2024-05-21 17:17:14 +02:00

View File

@@ -226,18 +226,19 @@ impl NodeRuntime for RealNodeRuntime {
let node_binary = installation_path.join(NODE_PATH); let node_binary = installation_path.join(NODE_PATH);
let npm_file = installation_path.join(NPM_PATH); let npm_file = installation_path.join(NPM_PATH);
let mut env_path = node_binary let mut env_path = vec![node_binary
.parent() .parent()
.expect("invalid node binary path") .expect("invalid node binary path")
.to_path_buf(); .to_path_buf()];
if let Some(existing_path) = std::env::var_os("PATH") { if let Some(existing_path) = std::env::var_os("PATH") {
if !existing_path.is_empty() { let mut paths = std::env::split_paths(&existing_path).collect::<Vec<_>>();
env_path.push(":"); env_path.append(&mut paths);
env_path.push(&existing_path);
}
} }
let env_path =
std::env::join_paths(env_path).context("failed to create PATH env variable")?;
if smol::fs::metadata(&node_binary).await.is_err() { if smol::fs::metadata(&node_binary).await.is_err() {
return Err(anyhow!("missing node binary file")); return Err(anyhow!("missing node binary file"));
} }