PawarShubham3007 · 2022-04-16 15:38
Emacs doesn't detect node or node packages if I run `Emacs.app` but does work as expected if emacs is ran via terminal
I'm using few packages that rely upon node but for some reason emacs doesn't detect node even though its installed(using brew). As you can see by output of `executable-find` node is detected with the installed packages
I've this in my `early-init.el`
(add-to-list 'exec-path "/usr/local/sbin")
(add-to-list 'exec-path "/usr/local/bin")
​
[Demo of the problem](https://reddit.com/link/u50dr0/video/zj1t5566twt81/player)
General Info:
OS: Mac(v 12.3.1 (21E258))
Emacs: GNU Emacs 29.0.50(from Home brew)
Node: v17.9
ieure · 2022-04-16 16:50
macOS doesn't use your shell init files when it starts the graphical session, so when you launch Emacs outside the shell, none of that stuff is pulled in. This is a very common problem for Mac users.
You can use https://github.com/purcell/exec-path-from-shell to work around it.
MainCareless · 2022-04-16 18:19
Your $PATH var is being picked up in console, but not in GUI. See exec-path-from-shell for an easy way to get your env vars evaluate.
PawarShubham3007 · 2022-04-16 18:27
Yes that did solve the problem. Thanks
dm_g · 2022-04-17 09:28
You can always try to run [Emacs.app](https://Emacs.app) from the command line with debug mode enabled:
/Applications/Emacs.app/Contents/MacOS/Emacs --debug-init
ossan1987 · 2022-04-17 10:46
On macOS, the app bundle in fact executes a script to launch emacs. Don't remember it's a ruby or perl script, but you can edit it to set the path to node. Open the app bundle (right click on Emacs.app -> show contents). Then navigate to the script, i think it's called Emacs under the directory where usually app bundle organises its binary files. Then you can edit the script to append additional path variables (need some basic knowledge in the language used in the original script on how to set environment variables).
PawarShubham3007 · 2022-04-17 11:17
As u/ieure suggested. installing [exec-path-from-shell](https://github.com/purcell/exec-path-from-shell) is probably easier solution