Starting Node.js on MacOS programmatically

45 Views Asked by At

We are trying to start Node.js on MacOS programmatically.

The command we are running is /bin/zsh -ic node --version, where we try to establish the version.

For some reason this works for some users, but not others.

When it doesn't work, users get output like command not found: node or even errors related to their .zshrc file.

For those users however, the command does work when running through the terminal, either as node --version or /bin/zsh -ic node --version.

With one user we were able to fix the issue by replacing a line in his .zshrc:

original line:

source $(brew --prefix nvm)/nvm.sh

with which we get the error message command not found: brew

replaced with:

source /opt/homebrew/opt/nvm/nvm.sh

which solved the issue for this user.

But this process is not something we want to go through with all our users, especially as the original line works fine in all other cases.

0

There are 0 best solutions below