1

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 running npm 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:

hey
  • 2,643
  • 7
  • 29
  • 50
  • Can you ensure that you are on the latest version of Node v 12^ and run `npm install` again. Also can you show us your `package.json` file? – Eric Bishard Feb 27 '20 at 15:36
  • Thank you! I have added the version information and package.json now in a new section "Background information" above in the question. My *node* version is the latest LTS version (`12.16.1`); my *electron* version is the latest version and runs on node `12.13.0`. I wonder if the difference is an issue?! An additional run of `npm install` did not change the situation. – hey Feb 27 '20 at 19:53

0 Answers0