I’m trying to do some basic git and node / npm commands in Xojo via Shell.
I installed git and Node.JS on our Mac and everything is fine if I check the version in the Terminal:
If I want to do the same in Xojo via Shell I have a problem.
Git works but node or npm is not found:
Var s As New Shell
s.Execute "node --version"
MessageBox s.Result
Or add the System.EnvironmentVariable(“PATH”) output to the Shell using the commands (class mus remain active using the interactive runmode. But you can however sync the environment to the system if you wished.
// Sh = Shell in Interactive mode.
Sh.Execute("export PATH=" + System.EnvironmentVariable("PATH"))
Sh.Execute("node --version")
An alternative is to set the path yourself:
// Sh = Shell in Interactive mode.
Sh.Execute("export PATH=/path/to/node/js/bin/folder:/another/path"))
Sh.Execute("node --version")
Some thing like that, how you export the path is different on platforms. Since xojo’s shell class is an empty environment, you could/should set the env yoursef using this way or env files…