Tuesday, October 31, 2017

Flycheck, eslint & "libxml2 library not found" error

The javascript-eslint syntax checker requires an XML parser. It can use the built-in xml.el (a pure Elisp implementation) or it can employ the external libxml2 library. The latter is preferred because it's significantly faster.

The defaul Windows port of Emacs doesn't include the libxml2 dll. To get a proper version:

  1. Add the bin/ dir from the Emacs distro (where emacs.exe file is) to the PATH.

  2. Download a proper version of emacs-2x-ARCH-deps.zip bundle (i.e., watch for i686 vs. x86_64 builds).

  3. Extract 3 files from bin/ dir of the zip:

    • libiconv-2.dll
    • libxml2-2.dll
    • zlib1.dll

    & copy them to the Emacs bin/ dir.

  4. Restart Emacs.