Markdown preview in emacs fails: (pandoc?) error 127 - emacs

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)

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.

Related

Recipe terminated with fatal error: spawn latexmk ENOENT

I have just installed debian 10 as well as vscode. I have been struggling with this for 3 days now.. I installed texlive from terminal with the following command:
sudo apt install texlive
I then installed the latex workshop extension in vscode and tried building a .tex file. The following error popped up:
Recipe terminated with fatal error: spawn latexmk ENOENT.
I then preceded to install latexmk from terminal with:
sudo apt install latexmk
The same error kept popping up after that. The output showed this.
[14:59:34] Recipe step env: {}
[14:59:34] cwd: /home/phoenix/Documents/stellies/year4/2021/s&s-414/pracs/prac-4/report
[14:59:34] LaTeX build process spawned. PID: undefined.
[14:59:35] LaTeX fatal error: spawn latexmk ENOENT, . PID: undefined.
[14:59:35] Does the executable exist? PATH: /app/bin:/usr/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/node/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/cargo/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/python/bin
[14:59:35] The environment variable $SHELL: /bin/sh
I then proceded to review the texlive website. I noticed that i did not set the path variable to include the texlive binaries. The texlive website gives the following path to the binary files : PATH=/usr/local/texlive/2021/bin/x86_64-linux:$PATH
however /usr/local/texlive does not exist on my system for some reason. Where can i find the correct path to the texlive binaries on Debian 10?
I had the same problem. The root cause was: (1) software's bin folder missing from PATH; (2) bad file privileges. Consequently, VSC couldn't access latexmk, which explains the error messages.
In my case, the problem occurred on a mac, and specifically after I installed MacTex, which, in turn, installs Tex Live. I believe the same solution may apply to linux distros too.
Solution:
Claim file ownership (which was originally root) under folder /usr/local/texlive: sudo chown -R <username> /usr/local/texlive, where <username> is the OS-level user name. The fix will work for this specific user. If it is not enough, try instead setting group owner appropriately, and/or consider Step 3.
Add /usr/local/texlive/2021/bin/<software_dialect> to PATH. <software_dialect> depends on the installed software version: in my case it is universal-darwin; on linux it might be x86_64-linux.
If the problem persists, try to change file access permissions under /usr/local/texlive using chmod.
EDIT: As a final step, restart VSC for changes to take effect.
I recently encountered the same problem on MacOS Monterrey (M1 based). I used basictex (just for the context). As required by the installation instruction,
I added TeXLive to PATH,
installed latexmk package to the TeX distribution.
However, still got the same error as OP.
Afte reading the wiki again more carefully, what finally worked for me was as simple as restarting VS Code and MacOS. Everything works as expected after a reboot of the MAC.
I had this same problem on Mac recently, the fix that worked for me was to uninstall and reinstall the LaTeX Workshop extension.
I got the same issue , seems to be a misbehaving from Vscode on MacOS
check if the command is in the path on mac
-which command_you are running example which latexmk
If this output something that means you have your latex installed, otherwise go and installed it and make sure it is accessible via command line.
If latex is installed and you are getting that issue you can just restart your VSCode and everything will be okay.
Had a similar error and came across this post when looking for a solution.
I wanted to use texlive on Vscode with WSL2 on Windows 10. Installing texlive-full in wsl fixed this error for me.
On Mac, this is a way to fix the issue
Step1: reinstall mactex by downloading it from this link: http://www.tug.org/mactex/mactex-download.html
Step2: In your terminal do cd /usr/local, you should see texlive folder
Step3: In your terminal do sudo vim etc/paths to set the environment. Details are in this link: https://www.architectryan.com/2012/10/02/add-to-the-path-on-mac-os-x-mountain-lion/
Step4: In your terminal do /usr/local/texlive/2021/bin/x86_64-linux at the bottom. check the folder to see if the year is correct. Details in: http://www.tug.org/texlive/quickinstall.html.
Step5: Quit VC code completely, and reopen it.

Emacs OSX 10.13 configuration issue

Recently I pass to Emacs org because is really convenient to me to write note there.
So I installed all packages I needed (principally ORG and EVIL) but I didn't understand how to setup everything.
I installed emacs from brew without using cask, I linked it, and I'm sure that I'm using the version that I installed (26.1).
So in my ~/ folder I have a .emacs file in which I set up evil mode, and I have a /.emacs.d/ in which I have a lot of file. The problem is: whatever I wrote in a ~/.emacs.d/init.el seems doesn't effect emacs.
So I said "whatever, I'm going on github and I installed some complete configurations and then I customized them myself". I tried to install these two configurations.
https://github.com/hrs/dotfiles
https://github.com/larstvei/dot-emacs?files=1
But for some reason, after doing exactly what they say on README.org
nothing happens.
In particular the second link, after install and open emacs said I need to have ~/.cask/.cask.el but I don't have it.
Advice?

Emacs 21 C/C++ auto-complete mode

I am working on a server which uses a really old emacs. The only way to install plugins is by downloading the .el files and adding them to the ~/.emacs/ folder and then sourcing it from the main .emacs file. Would someone know of a C/C++ autocomplete plugin which works with Emacs 21? I tried auto-complete-mode but I get an error.
An error has occurred while loading `/home/sbhalla/.emacs':
Symbol's function definition is void: defvaralias
The same auto-complete-mode works fine on emacs 22.
You might be able to run Emacs 24 without root access:
Download and untar Emacs 24: http://gnu.mirror.iweb.com/emacs/emacs-24.5.tar.gz
./configure && make. It may tell you to disable some options, e.g. I had to compile ./configure --without-jpg --without-png
You should be able to run ./src/emacs
I've done this to get the latest version of Emacs on university machines without sudo access, so it could probably work for you too.

Markdown-preview does't work in emacs markdown mode

Markdown preview command doesn't work.
I installed markdown-mode.el on emacs by using package-install.
Then I created test.md file as a trial. Syntax hi-lighting apparently works fine in the text.
When I used "C-c C-c p" command in order to show markdown preview, I got following error message in backtrace buffer. Even if I saved test.md file in current directory, it still said "No such file or directory". The file is located in "~/workspace/daily_log/test.md."
I tried "M-x markdown-preview" instead of shortcut key. But it doesn't work,too.
Do I make a mistake about usage of markdown-mode? Any help would be appreciated. Thanks in advance.
Error message in backtrace buffer
Debugger entered--Lisp error: (file-error "Searching for program" "No such file or directory" "bash.exe")
call-process-region(1 36 "bash.exe" "/tmp/emacsAxnXZ9" #<buffer *markdown-output*> nil "-c" "markdown")
shell-command-on-region(1 36 "markdown" "*markdown-output*")
markdown("*markdown-output*")
markdown-preview()
call-interactively(markdown-preview nil nil)
command-execute(markdown-preview)
my environment
OS: Ubuntu 14.10
emacs: 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.12.2)
markdown-mode: markdown-mode-20140914.1012/
If you inspect the backtrace you'll see that this has nothing to do with your Markdown file.
markdown-preview needs an external markdown command that can generate HTML. It looks like whatever Markdown processor you are using is trying to call bash.exe (not bash) when converting your file.
You might have installed some Windows-centric Markdown converter.
You might have customized markdown-command, directly or indirectly causing it to call bash.exe.
Since you are on Ubuntu, a simple apt-get install markdown should give you a decent Markdown that works with markdown-mode's markdown-preview function. After installing markdown at the system level, make sure that Emacs has markdown-command set to markdown (the default value).

Web-mode does not load in emacs

I'm pretty new to emacs and I'm currently trying to configure it properly for my needs, but I can't make it load web-mode at all.
So, this is what I've done:
Downloaded web-mode.el from GitHub
Made sure the file is located in the correct directory: ~/.emacs.d/web-mode.el
Used the installation instructions from the official page
My .emacs file now looks like this
Issue:
When I'm trying to edit any of the file types specified in the .emacs file, it only runs the default modes. PHP Abbrev for PHP etc... I'm not receiving any error messages and when I'm running --debug-init it does not give any output.
Emacs version: GNU Emacs 23.1.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.18.9) of 2012-03-01 on sl6.fnal.gov
OS: Scientific Linux
Does anyone know how I can troubleshoot this further, or have solved similar issues?
You should let el-get install it for you. El-get is a package manager for emacs. It can install packages from github, emacswiki, elpa, an url, … http://wikemacs.org/index.php/El-get
It's very handy, you can update scripts easily, it manages dependencies, it lets you discover many stuff, you can easily share your config accross machines, etc.
Emacs 24 has package.el or ELPA by default. One can install it on emacs 23, but my experience isn't conclusive so I'd advise sticking with el-get, which is great.