-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exec command not found #880
Comments
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 In any case you cannot assume that npm will be installed on user machine. |
e.g. nodejs/installer#18 |
@develar Hi, sorry i do not assume that it is installed because it's required that node is already installed on the OS to use the app. The problem is that I did not understand whether it is possible or not execute this command because the response to the issue that you linked does not provide anything from what I read, am i mistaking? Also I do not understand what is written on StackOverflow, they are talking about to edit a conf file on the OS, i can't ask final app user to edit the file... What you suggest sorry? |
"reconstructing the entire shell environment" nodejs/installer#18 (comment) |
it's not possible due to node installer? |
Actually i found that using this:
exec works, could be a fix or it's going to take me to the hell too? 🗡 |
Yes. But please note — custom user env will be still not supported. So, "reconstructing the entire shell environment" is the only real complete solution. |
@develar sorry not supported where? on electron? |
Not supported by your app. For example, if on my machine npm will be installed to another dir. And dir will be specified in the shell PATH. |
@develar got it thanks :) do you think it's better to always ask which node or which npm and use the path to the executable anyway to have larger support? |
No, I suggest #880 (comment) |
I have some
exec()
command in my app for example:It works if i start the app from the shell but it won't if i build the dmg and install the app.
I get error in console:
npm command not found
So i tried this:
require('child_process').execSync('which npm').toString();
And i get this error:
Any advice?
Thank you
The text was updated successfully, but these errors were encountered: