Question:
I am trying to use couchbase in an electron application, but fail to run the electron application as soon as I include the couchbase module. How can I use couchbase with electron?
Error message:
C:\dev\app>npm start
> eej@1.0.0 start C:\dev\app
> electron .
App threw an error during load
Error: The module '\\?\C:\dev\app\node_modules\couchbase\build\Release\couchbase_impl.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 76. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at process.func (electron/js2c/asar.js:140:31)
at process.func [as dlopen] (electron/js2c/asar.js:140:31)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1016:18)
at Object.func (electron/js2c/asar.js:140:31)
at Object.func [as .node] (electron/js2c/asar.js:140:31)
at Module.load (internal/modules/cjs/loader.js:816:32)
at Module._load (internal/modules/cjs/loader.js:728:14)
at Module._load (electron/js2c/asar.js:717:26)
at Function.Module._load (electron/js2c/asar.js:717:26)
at Module.require (internal/modules/cjs/loader.js:853:19)
My main.js
file begins like this:
const { app, BrowserWindow } = require('electron')
var couchbase = require('couchbase');
function createWindow () {
What I have tried already:
- removing the
node_modules
directory and lock file and reinstalling via npm i - installing and running
electron-rebuild
- using the
--update-binary
switch when runningnpm i
- downgraded the npm version to an LTS version
Background information:
Node version:
PS C:\dev\app> node --version
v12.16.1
PS C:\dev\app> electron --version
v8.0.1
Electron uses node 12.13.0
:
We are using node 12.13.0, Chrome 80.0.3987.86, and Electron 8.0.1.
The version of electron-node and standalone node differ. I am not sure if this is okay?!
Content of my package.json
file:
{
"name": "app",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"start": "electron ."
},
"author": "",
"license": "ISC",
"devDependencies": {
"couchbase": "^3.0.0",
"electron": "^8.0.1",
"electron-rebuild": "^1.10.0"
},
"dependencies": {
"node-gyp": "^6.1.0"
}
}
Similar questions:
- Couchbase Node compiled against different node version: After I have added a comment I discovered that it is a unix specific question.
- Node - was compiled against a different Node.js version using NODE_MODULE_VERSION 51: I went through nearly all of the suggestions, but none of them seemed to work for me.