Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

The module build/Release/keytar.node was compiled against a different Node.js version #64

Closed
alexcroox opened this issue May 4, 2017 · 16 comments

Comments

@alexcroox
Copy link

alexcroox commented May 4, 2017

I'm using with Electron, install install runs fine but when importing it with node I get:

The module '.../node_modules/keytar/build/Release/keytar.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 51. This version of Node.js requires
NODE_MODULE_VERSION 53. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or`npm install`).

I tried npm rebuild keytar with no joy

@jgknott
Copy link

jgknott commented May 14, 2017

Having the same issue.

@shiftkey
Copy link
Contributor

shiftkey commented May 14, 2017

@alexcroox @jgknott does an npm rebuild fix the issue? If not, more information about your setup and steps to reproduce this is necessary...

@jgknott
Copy link

jgknott commented May 15, 2017

npm rebuild didn't work for me.

Here's the error I'm getting:

keytar.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 48. This version of Node.js requires
NODE_MODULE_VERSION 51. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or`npm install`).
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
    at Object.Module._extensions..node (module.js:598:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at /Users/jknott/Dropbox (Personal)/dev/ottter/desktop/node_modules/keytar/lib/keytar.js:1:161
    at Object.<anonymous> (/project/node_modules/keytar/lib/keytar.js:55:2)

I'm on node 6.10 and npm 4.2.0

@shiftkey
Copy link
Contributor

I'm on node 6.10 and npm 4.2.0

These seem recent enough. Any thoughts @BinaryMuse on why they might still be seeing this error?

@BinaryMuse
Copy link
Contributor

BinaryMuse commented May 15, 2017

Unless I'm mistaken, npm rebuild will just rebuild the module against Node's version, not Electron's. You'll need to use one of the methods in the Using Native Node Modules documentation.

@alexcroox
Copy link
Author

alexcroox commented May 16, 2017

I'm running node 7.6.0 and npm 4.1.2

@jgknott
Copy link

jgknott commented May 16, 2017

@BinaryMuse that solved it! Thank you!
Steps for mac:
npm install --save-dev electron-rebuild
./node_modules/.bin/electron-rebuild
I got some errors, on some packages but the keytar worked fine and now i'm able to run the app.

@alexcroox
Copy link
Author

Does this mean the dev environment needs to be setup on each target OS and the module rebuilt on each? Or does a rebuild once on Mac cover all OS's?

@shiftkey
Copy link
Contributor

Does this mean the dev environment needs to be setup on each target OS and the module rebuilt on each?

@alexcroox yes, because the native toolchain is OS-dependent

@liowmei
Copy link

liowmei commented Sep 22, 2017

Hi, i am new in using the firmware and i encounter the problem as below :
The module '\?\C:\Users\user.atom\packages\Pymakr\precompiles\serialport-win\build\Release\serialport.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 49. This version of Node.js requires
NODE_MODULE_VERSION 53. Please try re-compiling or re-installing
the module (for instance, using npm rebuild ornpm install).

May i know how can i fix it? Thanks

@CorentinGC
Copy link

@liowmei Read the comment of @BinaryMuse and @jgknott ;)
I am using serialport too, and this worked like a charm !

@stuardcg
Copy link

delete node_module and run npm i

@massi67
Copy link

massi67 commented Jan 2, 2018

Can somebody send steps to resolve issue in Windows?

@Riz-waan
Copy link

@massi67 did you try what @Arthaclarius said?

@mohamedbrahimi
Copy link

the same issue !, please any suggestion

@BinaryMuse
Copy link
Contributor

Hi, folks,

Please see the comment that I posted earlier. You'll need to follow the instructions on the Using Native Node Modules page on the Electron site. I personally use and recommend the strategy described in Installing modules and rebuilding for Electron, which describes how to fix this problem with the electron-rebuild package.

Since the original issue is solved, I'm going to lock this issue. If you have a different problem, or have tried the above steps and it doesn't work, then please create a new issue and we can work to resolve it separately.

@atom atom locked as resolved and limited conversation to collaborators Oct 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants