21

I am trying to create a markdown document in Emacs *.

It does highlight the syntax etc. and goes into Markdown mode (I am not quite sure if I installed that package or if it is standard issue)..

Problem:

When I try to create a preview (either via C-c C-c p or the GUI), it returns this error code:

markdown failed with exit code 127

Question

  • What does this error tell me? Is there a way to get a more complete error message?

  • The docs for markdown-mode suggest that it calls on an external library such as pandoc, which I have installed. According to these SO questions, pandoc can return this error code, but I could not quite establish what it means.

  • How do I fix this / what documentation should I go to?

I am pretty new to Emacs, so anything will help. Thanks!

*Emacs version 25.3.1 on a Mac (Sierra 10.12.6)

Community
  • 1
  • 1
patrick
  • 4,455
  • 6
  • 44
  • 61
  • 16
    Pandoc doesn't use error code 127. My [guess](https://stackoverflow.com/questions/1763156/127-return-code-from) is that emacs cannot find a `markdown` program. You might have to symlink to pandoc (or configure emacs, e.g. by running M-:`(setq markdown-command "/usr/bin/pandoc")`) to make it work. – tarleb May 22 '18 at 19:53
  • 1
    thank you sir, that solved all my problems. Much appreciated. As explained in the link, 127 is a general shell error code that the function was not found. – patrick May 22 '18 at 20:24
  • Just first make sure you have `pandoc` installed and if not, install it. – Ioanna May 15 '19 at 06:57

1 Answers1

6

The simplest fix is likely to install the markdown package using your package manager.

I fixed this error for myself with:

$ brew install markdown

(on MacOS Mojave, at the bash command line). Brew installed the "bottle" markdown-1.0.1.mojave.bottle.tar.gz, after which C-c C-c p or M-x markdown-preview worked to export the markdown file and open a browser window showing the exported file.

On an Ubuntu 19 (and now 20.04 and 21.10) system, sudo apt install markdown worked too.

You could do the same thing with a symlink to pandoc's markdown, but a) this just worked, b) there's no fiddling with a potentially messed up manually created symlink, and c) it's tiny (a 36 KByte executable). Pandoc's markdown may support more "modern" markdown, though.

  • For Ubuntu user, it would be `sudo apt install markdown`. Once `markdown` package was installed, the preview started working for me – Samyak Bhuta Oct 13 '19 at 11:40