Open hew-wolff opened 4 years ago
i get same error
I found this issue in NVM repository. I tried sudo env node
in the terminal and had the same error as I got in emacs, i.e env: node: No such file or directory
.
I am not sure why emacs has the same behavior as running sudo
, but it only happens when I start emacs from desktop. If I run emacs from command line (with or without GUI), prettierjs works as expected.
I hope it helps even if it doesn't solve the problem completely. Maybe a more in depth reading of that thread will lead you to the answer, I am satisfied with running it from command line.
I do have this problems with MacOS also.
It seems to be a broader issue then just prettier.
When I start Emacs from Applications or Spotlight, env outputs different then when loading from the terminal.
You can output your env in shell and then output the env from e-shell inside emacs. If they are different you have this "broader" problem.
When launching from command line, repeat this experiment and you'll see both will be the same values.
This guy here made a "fix" for MacOS. If you're not in MacOS, I am sure something can be done with xdg or the default X launcher: https://gist.github.com/d12frosted/18ed4b3b5d5267428a0da16da6d016b4
Also this did not fixed for me.
I usually run:
$ Open /Application/Emacs.app
Try copying your ~/.bashrc to ~/.bash_profile. And source ~/.bash_profile.
I found the solution to this problem by installing this beauty from MELPA: https://github.com/purcell/exec-path-from-shell
After install, justa add this anywhere in your .emacs file:
(exec-path-from-shell-initialize)
And that's it. Now your shell path is available to GUI MacOS fired from from Desktop Applications, allowing you to run prettier, node, etc.
Running prettier-js gives the error above. I did some searching and reading, and found that the "env" error usually means something is missing from the Emacs exec-path, so I tried things like this in .emacs:
As far as I can tell, node and prettier are both available at that path, but I still get the error.
Environment: