Skip to content

Commit 71e4841

Browse files
Merge pull request #61 from Snowblaze/am/env-var-path
fix: set path variables when trying to run npm commands
2 parents 17d1fca + 23d508f commit 71e4841

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Editor/Utils/McpUtils.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,11 @@ public static void RunNpmCommand(string arguments, string workingDirectory)
353353
// Fallback to /bin/bash to find 'npm' in PATH
354354
startInfo.FileName = "/bin/bash";
355355
startInfo.Arguments = $"-c \"npm {arguments}\"";
356+
357+
// Ensure PATH includes common npm locations and current PATH
358+
string currentPath = Environment.GetEnvironmentVariable("PATH") ?? string.Empty;
359+
string extraPaths = "/usr/local/bin:/opt/homebrew/bin";
360+
startInfo.EnvironmentVariables["PATH"] = $"{extraPaths}:{currentPath}";
356361
}
357362

358363
try

0 commit comments

Comments
 (0)