When receiving an error such as below:
Error: The module '/<project_path>/<project_name>/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/build/Release/better_sqlite3.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 137. This version of Node.js requires
NODE_MODULE_VERSION 141. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
My issue is that I used my OS's package manager (pacman) to install nodejs and pnpm. So even though I used nvm to set the correct node version, 24.11, Webstorm was using /usr/bin/node (v25.xx).
Three options to fix
-
Update Webstorm to use the intended node interpreter -
~/.config/nvm/versions/node/v24.11.0/bin/node -
Use the package manager to remove
nodejs. Webstorm will then default to usingnvm's set version -
Use the package manager to remove
pnpmand install pnpm via npm -npm install -g pnpm
Ultimately, 2 + 3 gives gives a single source of truth by having nvm manage everything.