installer
installer copied to clipboard
Cannot find node to check version if app is packed on MacOS
An app launched by a GUI launcher (Finder, Dock, Spotlight etc.) receives a pretty empty and useless environment, since standard Unix ways of setting variables via e.g. ~/.profile do not work.
http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x
So, code exec('node --version' in the check-node.js doesn't work because node cannot be found (if you run app, not electron ., see #17).
@develar what if we add this script for bash_profile, and then for bashrc, zshrc and others?
grep export $HOME/.bash_profile | while IFS=' =' read ignoreexport envvar ignorevalue; do
launchctl setenv ${envvar} ${!envvar}
done
alternatively, instead of node --version it can be /usr/local/bin/node --version
/usr/local/bin/node --version won't work for non-standard installations.
@mikeal This may be blocking, although we could read the relevant files and construct a $PATH to pass to child_process.exec()...
what if we add this script for bash_profile, and then for bashrc, zshrc and others?
Yes, JetBrains IDEs uses this approach: https://github.com/JetBrains/intellij-community/blob/master/platform/util/src/com/intellij/util/EnvironmentUtil.java#L154
https://github.com/JetBrains/intellij-community/blob/master/bin/mac/printenv.py
reconstructing the entire shell environment is going to be hard. we'll also have to recognize that this will end up enabling versions managers which won't actually pick up the installation we currently do. if we go down the route of reconstructing the shell env we'll need to also handle detecting and possibly disabling node version managers.
IMO, for now having at least the standard path is a good start