royaltm / node-murmurhash-native

MurmurHash native bindings for node
MIT License
48 stars 7 forks source link

Not working with win10+electron, osx+electron@beta #13

Open BananaAcid opened 6 years ago

BananaAcid commented 6 years ago

OSX works, when I use NVM to set the same Node version (since NODE_MODULE_VERSION must match the node verison) as used by electron, but would exit when using electron@beta with the matching node version.

Windows 10 would just exit on setting 1, and show an error on setting 2.

Using the normal node version, it works fine.

Used babel - see the GIST for all files and installation: https://gist.github.com/BananaAcid/6c15120ed62828c7bce42af9977af10e

node module versions: https://nodejs.org/en/download/releases/ used node version by electron: https://electronjs.org/ -> see Releases boxes.

royaltm commented 6 years ago

Thanks for the report.

For nwjs or electron you probably need to build every native module with special target. Please compare with this issue: https://github.com/royaltm/node-murmurhash-native/issues/9.

I'm not familiar with electron.

Please consult https://electronjs.org/docs/tutorial/using-native-node-modules.

I'll look into it myself when I'll have more time.

royaltm commented 6 years ago

Ok, I really quickly managed to solve the problem following the advice on the page I have given above.

  1. get your gist
  2. add some package.json (npm init and leave all default)
  3. fix app.mjs by adding missing import fs from 'fs'; at the top of the file
  4. npm i electron babel-core babel-preset-electron
  5. npm i electron-rebuild
  6. ./node_modules/.bin/electron-rebuild √ Rebuild Complete
  7. node_modules/electron/dist/electron index.js
    app should have started...
    fin.
    hash 09b8326b of file (...)\app.mjs