Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

Cannot find node to check version if app is packed on MacOS #18

Open
develar opened this issue Jul 1, 2016 · 6 comments
Open

Cannot find node to check version if app is packed on MacOS #18

develar opened this issue Jul 1, 2016 · 6 comments

Comments

@develar
Copy link
Contributor

develar commented Jul 1, 2016

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).

@azat-co
Copy link
Contributor

azat-co commented Jul 2, 2016

@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

@SomeoneWeird
Copy link
Member

/usr/local/bin/node --version won't work for non-standard installations.

@Fishrock123
Copy link
Contributor

@mikeal This may be blocking, although we could read the relevant files and construct a $PATH to pass to child_process.exec()...

@develar
Copy link
Contributor Author

develar commented Jul 4, 2016

@mikeal
Copy link
Contributor

mikeal commented Jul 5, 2016

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.

@azat-co
Copy link
Contributor

azat-co commented Jul 6, 2016

IMO, for now having at least the standard path is a good start

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants