atom / highlights

Syntax highlighter
https://atom.github.io/highlights
MIT License
530 stars 54 forks source link

Use Highlights in an Electron app: "Uncaught Error: Module version mismatch #22

Closed maveonair closed 9 years ago

maveonair commented 9 years ago

I want to use highlights in an app that I am building with Electron but I always get the error message when I start the app:

"Uncaught Error: Module version mismatch. Expected 44, got 14.", source: ATOM_SHELL_ASAR.js (137)

I have added highlights as a dependencies via npm: npm install highlights --save and I start the app via a gulp task and npm:

// using ES6 with Babel
import Highlights from 'highlights';

// More code...
// More tasks above...
gulp.task('run', ['clean-and-build'], function() {
  return run('electron .').exec();
});
$ npm start # which executes gulp run

What would be the proper way to add highlights as an dependencies to an Electron based app?

maxbrunsfeld commented 9 years ago

Hi @maveonair,

That error means that the native code in highlights was compiled using the headers from a different version of V8 than Electron uses. In this case, it was compiled to work with the version of node.js that you have installed on your system. You need to rebuild highlights to work with electron.

The best explanation of this is this page from the electron docs.

Let me know if you have further problems; we'll make sure you get this working.