DEV Community

foxgem
foxgem

Posted on

4 1

Troubleshooting: compiled against a different Node version

Symptom

Running a node project with the dependency on Better Sqlite3 got the following error message:

Error: The module '... /node_modules/better-sqlite3/build/Release/better_sqlite3.node'
  was compiled against a different Node.js version using
  NODE_MODULE_VERSION 83. This version of Node.js requires
  NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
  the module (for instance, using `npm rebuild` or `npm install`).

  ' the module (for instance, using `npm rebuild` or `npm install`).
  ' bindings (node_modules/bindings/bindings.js:112:48)

Enter fullscreen mode Exit fullscreen mode

Cause

The error message itself contains enough details, also shows the cause and solution.

In short: the node version used to compile the installed better_sqlite3 is not the same as the node version currently used, so it asks to recompile it with the current version.

Solution

  • npm i -D electron-rebuild.
  • Delete the node_modules directory.
  • In package.json add scripts to.
    "rebuild": "electron-rebuild -f -w better-sqlit3",
Enter fullscreen mode Exit fullscreen mode
  • npm i
  • npm rebuild

Reference link:

API Trace View

How I Cut 22.3 Seconds Off an API Call with Sentry 🕒

Struggling with slow API calls? Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs