tensor5/arch-atom

Module version mismatch

Closed this issue · 6 comments

I want to packaging atom for Fedora. But version mismatch when running with electron usr/lib64/atom.

$ node-gyp -v
v0.10.6
$ node -v
v0.10.42
$ npm -v
2.13.3
$ apm -v
apm  1.6.0
npm  2.13.3
node 0.10.40
python 2.7.10
git 2.5.0
$ electron usr/lib64/atom
App threw an error when running [Error: Module version mismatch. Expected 47, got 43.]
Module version mismatch. Expected 47, got 43.
Error: Module version mismatch. Expected 47, got 43.
    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 Object.<anonymous> (/usr/lib64/atom/node_modules/nslog/lib/nslog.js:5:11)
    at Object.<anonymous> (/usr/lib64/atom/node_modules/nslog/lib/nslog.js:15:4)

I try to download and execution electron atom.xz/(atom.xz). It works fine. However, i try to execution electron atom.rpm/(atom.rpm, Specfile), return above error.

I will be atom.xz/node_modules/nslog/build/Release/nslog.node copied toatom.rpm/node_modules/nslog/build/Release/nslog.node. It works fine.

How to solve this problem? Thanks.

You need to build Atom using the same version of node/v8 headers that your electron uses.

The current version of electron includes node 5.1.1 which uses module version 47 (as you can see here).

You are trying to run an Atom that was built with an older version of node (0.10.*) that defines module NODE_MODULE_VERSION 43.

Rebuild Atom following my instructions and adapt them to make a .spec file.

Very grateful. Let me try.

The npm_config_target flag is no effect. I just set upATOM_ELECTRON_VERSION flag. Log is as follows

set npm_config_target

+ export npm_config_cache=/builddir/.atom/.npm
+ export npm_config_disturl=https://atom.io/download/atom-shell
+ export npm_config_target=0.36.8
+ export npm_config_runtime=electron
+ apm install --verbose
gyp verb cli [ '/usr/lib/node_modules/atom-package-manager/bin/node',
gyp verb cli   '/usr/lib/node_modules/atom-package-manager/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'install',
gyp verb cli   '--target=0.22.0',   <--------------------- Error !!!
gyp verb cli   '--dist-url=https://atom.io/download/atom-shell',
gyp verb cli   '--arch=x64',
gyp verb cli   '--ensure',
gyp verb cli   '--verbose' ]

set ATOM_ELECTRON_VERSION

+ export npm_config_cache=/builddir/.atom/.npm
+ export npm_config_disturl=https://atom.io/download/atom-shell
+ export npm_config_target=0.36.8
+ export npm_config_runtime=electron
+ export ATOM_ELECTRON_VERSION=0.36.8
+ apm install --verbose
gyp verb cli [ '/usr/lib/node_modules/atom-package-manager/bin/node',
gyp verb cli   '/usr/lib/node_modules/atom-package-manager/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'install',
gyp verb cli   '--target=0.36.8',   <--------------------- OK !!!
gyp verb cli   '--dist-url=https://atom.io/download/atom-shell',
gyp verb cli   '--arch=x64',
gyp verb cli   '--ensure',
gyp verb cli   '--verbose' ]

I think it might be npm version too old.

+ node-gyp -v
v0.10.6
+ node -v
v0.10.42
+ npm -v
2.13.3
+ apm -v
apm  1.7.0
npm  2.13.3
node 0.10.40
python 2.7.10
git 2.5.0

Thank you for your reply. The Atom can finally work properly.

I remember know.

Normally apm (the Atom package manager) has a logic to determine the electron version to use, and if that logic doesn't work it defaults to 0.22.0. I build apm separately and patch it to use the correct version of electron which is written on the file /usr/lib/electron/version. Take a look at the PKGBUILD and the patch.

Yes, I see it. Initially, I do not know why we need this patch.
Thank you for your reply. This issue has been resolved.

Next, I want to compile the electron for Fedora.

Good luck!