Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node module version error #79

Closed
Dotnaught opened this issue Sep 6, 2020 · 3 comments
Closed

Node module version error #79

Dotnaught opened this issue Sep 6, 2020 · 3 comments
Assignees
Labels

Comments

@Dotnaught
Copy link

Node 12.16.3
NVM 0.35.3
macOS 10.15.6
Electron 10.1.1
re2 1.15.4
npm 6.14.4

I get this error in the console with an RSS app I'm working on. I've tried deleting node_modules and package-lock.json then npm i and ./node_modules/.bin/electron-rebuild but that disconnects Chrome DevTools so I can't inspect the app.

Without the rebuild, the app runs but throws the error below in the console.

Node.js 12.16.3 corresponds with Node Module Version 72.

82 lists Electron 10.

Any ideas beyond reverting to an older version of Electron?

Uncaught Error: The module '/Users/xxx/Code/Git/xxx/node_modules/re2/build/Release/re2.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 82. Please try re-compiling or re-installing
the module (for instance, using npm rebuild or npm install).
at process.func [as dlopen] (electron/js2c/asar.js:140)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1196)
at Object.func [as .node] (electron/js2c/asar.js:140)
at Module.load (internal/modules/cjs/loader.js:981)
at Module._load (internal/modules/cjs/loader.js:881)
at Function.Module._load (electron/js2c/asar.js:769)
at Module.require (internal/modules/cjs/loader.js:1023)
at require (internal/modules/cjs/helpers.js:77)
at Object. (/Users/xxx/Code/Git/xxx/node_modules/re2/re2.js:3)
at Object. (/Users/xxx/Code/Git/xxx/node_modules/re2/re2.js:26)

@uhop uhop self-assigned this Sep 8, 2020
@uhop uhop added the bug A reported bug. label Sep 8, 2020
@uhop
Copy link
Owner

uhop commented Sep 8, 2020

It looks like there are two different environments with different Node versions. One environment is used to build a library, another is to run it. There is no way around it.

Electron comes with some black magic for native modules, which breaks when precompiled modules are used — looks like it uses a wrong Node for it. There is even a note about it.

re2 does not use node-gyp-pre but relies on similar technology. There is a way to bypass getting a precompiled module: just define an environment variable DEVELOPMENT_SKIP_GETTING_ASSET (any non-empty value would do) and it will revert to always build it from source code as recommended by Electron.

Let me know if it works for you and I'll add it to the wiki.

@uhop uhop added question and removed bug A reported bug. labels Sep 8, 2020
@Dotnaught
Copy link
Author

Thanks. That got rid of the error.

My code still produces the issue where the main Electron window doesn't appear to load -- the same result when I did npm rebuild. But at least it executes and outputs to the console, which it failed to do before. I suspect it's working properly under the hood and there's an issue with my content security policy that its preventing the window from displaying properly. I'll deal with that when I have time.

Thanks again.

@uhop
Copy link
Owner

uhop commented Sep 9, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants