electron / electron

:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS
https://electronjs.org
MIT License
114.3k stars 15.41k forks source link

Difficulty with native module ursa #1232

Closed mattcollier closed 9 years ago

mattcollier commented 9 years ago

The following log shows the 'npm install' and subsequent execution of my project: http://hastebin.com/kuperovoma.coffee

I'm getting a module version mismatch. I understand that I need to build the native module against appropriate headers, but I am clueless about what version I should be attempting to use.

I have attempted to use apm as per https://github.com/atom/atom-shell/blob/master/docs/tutorial/using-native-node-modules.md

but I don't know what value to use for 'export ATOM_NODE_VERSION=????'

Any assistance is greatly appreciated.

anaisbetts commented 9 years ago

https://github.com/paulcbetts/grunt-build-atom-shell#correctly-setting-nodeversion has the chart of Atom versions => ATOM_NODE_VERSION versions

mattcollier commented 9 years ago

Thanks Paul, but how do I correlate that with my error message?

Error: Module version mismatch. Expected 41, got 43.

I can also add that the ursa module works fine with io.js v1.5.0

anaisbetts commented 9 years ago

@mattcollier That version has zero to do with a real version number, it's just a constantly incrementing value.

mattcollier commented 9 years ago

Thank you again for the information. How would you recommend that I proceed with trying to get my project up and running?

anaisbetts commented 9 years ago

export ATOM_NODE_VERSION=0.20.0

mattcollier commented 9 years ago

With 'export ATOM_NODE_VERSION=0.20.0', I get:

Error: Module version mismatch. Expected 41, got 17.

full error: http://hastebin.com/efihofifil.coffee

tried 0.20.1, 0.20.2, and 0.20.3. All produce the same error.

bwin commented 9 years ago

Hi Matt, which Atom-Shell version are you using? On which platform? Ursa version?

Edit: AS 0.21.3, ursa@0.8.3, linux64. I got that from your hastebin, but I think this info belongs in the issue.

bwin commented 9 years ago

That version has zero to do with a real version number, it's just a constantly incrementing value.

Whats Paul Betts meant in that case was that, the Module version has nothing to do with the atom-shell version.

You're using 0.21.3, so ATOM_NODE_VERSION should also be 0.21.3. Better put your version number in the issue.

Edit: Or am I confused here?

bwin commented 9 years ago

If I try to rebuild ursa by hand with node-gyp rebuild --target=0.21.3 --arch=x64 --target_platform=linux --dist-url=https://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist, I get weird nan-errors. Sorry I'm no help here.

anaisbetts commented 9 years ago

Whats Paul Betts meant in that case was that, the Module version has nothing to do with the atom-shell version.

No, the module version is yet another version number. There's the Atom Shell version (a SemVer version), the Node.js version (also a SemVer version), and a related but completely separate value, the module version (an Integer that is monotonically increasing)

mattcollier commented 9 years ago

Just want to document some of what Benjamin (bwin) tried:

If I do: node-gyp rebuild --target=0.21.3 -arch=x64 --target_platform=linux --dist-url=https://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/distcd

The following errors occur. This applies to 21.0,21.1,21.2 as well http://hastebin.com/itinalixol.vhdl

If I do: node-gyp rebuild --target=0.20.0 -arch=x64 --target_platform=linux --dist-url=https://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/distcd

It does build, but I get the aforementioned version error: Error: Module version mismatch. Expected 41, got 17.

mattcollier commented 9 years ago

Good news!!!

Since nan seemed to be the unhappy module after my last round of build attempts, I decided to see if any nan updates were available. Turns out v1.7 was recently released. I changed the package.json inside of the ursa module to download the dependency from github. I was then able to successfully rebuild ursa using:

node-gyp rebuild --target=0.21.3 -arch=x64 --target_platform=linux --dist-url=https://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/distcd

And after the successful rebuild, my project launches now as well!

Thanks for the help everyone! Very happy that I can move forward now.

bwin commented 9 years ago

@mattcollier: Nice. Sorry for the typo with x64 in --arch although it doesn't (really) matter (in that case). I can confirm that it works with nan@1.7.0. Maybe close this issue and open up a new one over at ursa and tell them that? Edit: Once you're in the ursa dir you can also just do npm i -S nan@1.7.0.

@paulcbetts I have expressed myself wrong. "has nothing to do ..." is wrong, since there is a relation between atom-shell/node version and module version. I was influenced (in my choice of words) by your "zero to do with a real version number" (which is correct). tl;dr of course you're correct, but I meant the same. (It's amazing how long it took me to write these two or three sentences and after consulting Google Translate twice I'm still not satisfied. So I most likely meant to say something completely different.Edit:™ :wink: )

zcbenz commented 9 years ago

As @bwin said I think this issue can be closed now.