« Back to home

Play with Mirusan

Posted on

I was interested in dealing with PDF files in JavaScript. I found Mirusan on github.

NOTE: I couldn’t get it work on my mac. It is just a note.

Work log

It has some python code and it requires python3.

However, I didn’t have python3 on my system.

Get python3 on a Mac.

brew install python3

By using pip3 command, install packages against python3.

pip3 install -r requirements.txt

requirements.txt looks like this:


It is a definition file for pip command and is a simple, line-based format.

An unladen web framework for building APIs and app backends
Extensions to the standard Python datetime module
Fast, pure-Python full text indexing, search, and spell checking library
langdetect 1.0.7
Language detection library ported from Google’s language-detection
PyInstaller bundles a Python application and all its dependencies into a single package
pip3 install -r requirements.txt

This installed these packages.

side track

When I ran pip3 install command, it said the version is outdated.

You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
pip3 install --upgrade pip


cd ../electron
npm install

side track(2) - can I open two places in VSCode?

You can do this with Multi-root Workspaces feature!


npm run compile

This runs a command defined in "script"’s compile.

    "scripts": {
        "compile:elm": "elm-make ./src/Main.elm --output elm.js",
        "compile:babel": "babel pdf2txt.js > ./lib/pdf2txt.js",
        "compile": "npm-run-all -p compile:*",
    "devDependencies": {
        "npm-run-all": "^4.0.1",


npm-run-all runs a series of npm run commands. In this example, it runs npm run compile:elm and npm run compile:babel.

What is Elm?

Elm is a functional language that compiles to JavaScript.

The web site says:

It competes with projects like React as a tool for creating websites and web apps.

Elm has a very strong emphasis on simplicity, ease-of-use, and quality tooling.

The main code is written in Elm and is located at murisan/electron/src/.

elm-make ./src/Main.elm --output elm.js compiles elm code into JavaScript code and generates elm.js file.

What is babel?

Babel is a tool to convert JavaScript code written in newer standard like ES5 into the old JavaScript so that it can run browsers.

babel pdf2txt.js > ./lib/pdf2txt.js"

So, the converted version is written in murisan/electron/lib/pdf2txt.js.


npm start

and I saw the following error:

A JavaScript error occurred in the main process

Uncaught Exception:
Error: spawn ./mirusan_search ENOENT
  at exports._errnoException (util.js:1050:11)
  at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
  at onErrorNT (internal/child_process.js:367:16)

It looks like mirusan_search executable is missing.

I’ve searched on github and:

// Laucn python subprocess
if (Config.mode == 'release') {
  if (process.platform == 'win32') { var subpyName = 'mirusan_search.exe'; }
  else { var subpyName = 'mirusan_search'; }
  var subpy = require('child_process').spawn('./' + subpyName, ['--server']);
} else if (Config.mode == 'debug') {
  var subpy = require('child_process').spawn('python3', ['../search/search.py', '--server']);

mirusan_search needs to be at mirusan/electron directory, but I don’t see it.

I’ve updated the config file (config.json) to have

  "mode": "debug"
npm start

It starts, but it shows DevTool.

It showed some error message on the console too:

$ npm start

> Mirusan@0.1.0 start /Users/gaku/tz/mirusan/electron
> electron main.js

[15:14:14:0003] [info] Checking for update
[15:14:14:0302] [error] Error: Error: ENOENT, dev-app-update.yml not found in /Users/gaku/tz/mirusan/electron/node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar
    at notFoundError (ELECTRON_ASAR.js:115:19)
    at fs.readFile (ELECTRON_ASAR.js:478:16)
    at go$readFile (/Users/gaku/tz/mirusan/electron/node_modules/graceful-fs/graceful-fs.js:73:14)
    at readFile (/Users/gaku/tz/mirusan/electron/node_modules/graceful-fs/graceful-fs.js:70:12)
    at readFile (/Users/gaku/tz/mirusan/electron/node_modules/universalify/index.js:5:67)
    at /Users/gaku/tz/mirusan/electron/node_modules/electron-updater/src/AppUpdater.ts:361:27

When I tried to load a pdf file, it also showed the following error.

There are too many issues and I decided not to continue at this point.