atomus icon indicating copy to clipboard operation
atomus copied to clipboard

Error: Module version mismatch on ready

Open lgodard opened this issue 9 years ago • 8 comments

Hi

Just starting exploring Atomus, seems promising I experience an error on ready event is it a known problem, or is it something i do wrong ? feel free to ask if more needed Thanks a lot

Laurent

  • the code
fs.readFile(path.join(__dirname, '../../www/html/login.html'), 'utf8', function(err, html_string) {
    if (err) {
        throw err;
    }
    console.log(html_string); // correct
    atomus()
    .html(html_string)
    .ready(function(errors, window) { // error here
  • the error
[Error: Module version mismatch. Expected 47, got 46.]
Error: Module version mismatch. Expected 47, got 46.
    at Error (native)
    at process.module.(anonymous function) [as dlopen] (ATOM_SHELL_ASAR.js:159:20)
    at Object.Module._extensions..node (module.js:450:18)
    at Object.module.(anonymous function) [as .node] (ATOM_SHELL_ASAR.js:159:20)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at bindings (/home/lgodard/projets/nodejs/fec/src/node_modules/atomus/node_modules/jsdom/node_modules/contextify/node_modules/bindings/bindings.js:76:44)
    at Object.<anonymous> (/home/lgodard/projets/nodejs/fec/src/node_modules/atomus/node_modules/jsdom/node_modules/contextify/lib/contextify.js:1:113)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/home/lgodard/projets/nodejs/fec/src/node_modules/atomus/node_modules/jsdom/lib/jsdom/browser/index.js:5:21)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/home/lgodard/projets/nodejs/fec/src/node_modules/atomus/node_modules/jsdom/lib/jsdom.js:10:27)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at process (/home/lgodard/projets/nodejs/fec/src/node_modules/atomus/lib/index.js:37:17)
    at Object.api.ready (/home/lgodard/projets/nodejs/fec/src/node_modules/atomus/lib/index.js:185:5)
    at /home/lgodard/projets/nodejs/fec/src/test/main/html_login.test.js:19:6
    at tryToString (fs.js:414:3)
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:401:12)

lgodard avatar Feb 05 '16 17:02 lgodard

testing with a given example show same problem

atomus().html('<html><head></head><body></body></html>')
.injectJS('var getTheAnswer = function() { return 42; }')
.ready(function(errors, window) {
  console.log(window.getTheAnswer()); // 42
});

lgodard avatar Feb 05 '16 17:02 lgodard

Thanks for the report. I'll investigate soon.

krasimir avatar Feb 05 '16 19:02 krasimir

@lgodard what's your node versions. I just tested the code from your last comment and it works.

krasimir avatar Feb 06 '16 15:02 krasimir

Hi thanks a lot my version is

$ node --version
v4.2.2

feel free to ask if anything more needed

Thanks again

Laurent

lgodard avatar Feb 07 '16 05:02 lgodard

Thanks. I'll try testing with that version.

krasimir avatar Feb 07 '16 06:02 krasimir

Hi,

Thanks a lot for your response just had time today for further investigation.

I think i found a workaround on installing new jsdom and a symlink

$ npm install jsdom --save-dev
$ ln -s node_modules/jsdom/  node_modules/atomus/node_modules/jsdom

Then, all is working !! (and atomus is as great as expected !)

Obviously, this is just a workaround and not 'ready-for-production' But it seems that the problem solution would be to have a look at jsdom required version

Hope this helps and feel free to ask if more is needed

Thanks a lot again

Laurent

lgodard avatar Feb 11 '16 11:02 lgodard

Thanks @lgodard. I didn't have time to investigate further since I'm heavily depending on an old version of Node. I had to spin up a VM to test on 4.2. Anyways, thank you for the time spent in this. What's the version of jsdom that worked for you.

krasimir avatar Feb 11 '16 12:02 krasimir

the latest installed "jsdom": "^8.0.2"

lgodard avatar Feb 11 '16 13:02 lgodard