[英]npm rebuild doesn't work when trying to fix different node module version error
I'm getting an error where the better_sqlite3 package is using a different version of node, and it says to try npm rebuild
and npm install
but this doesn't solve anything and I'm still getting the same error.我收到一个错误,其中 better_sqlite3 package 使用不同版本的节点,它说尝试
npm rebuild
和npm install
但这个错误仍然没有解决。
/home/nonce/Documents/Repositories/test/node_modules/bindings/bindings.js:121
throw e;
^
Error: The module '/home/nonce/Documents/Repositories/test/node_modules/better-sqlite3/build/Release/better_sqlite3.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 102. 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`).
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at bindings (/home/nonce/Documents/Repositories/test/node_modules/bindings/bindings.js:112:48)
at Object.<anonymous> (/home/nonce/Documents/Repositories/test/node_modules/better-sqlite3/lib/database.js:9:24)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32) {
code: 'ERR_DLOPEN_FAILED'
}
I don't think this is an error with better-sqlite3 itself, since I've done some research and a lot of people have gotten this sort of error, and the general solution is to execute npm rebuild
but for me this doesn't do anything.我不认为这是 better-sqlite3 本身的错误,因为我已经做了一些研究并且很多人都得到了这种错误,一般的解决方案是执行
npm rebuild
但对我来说这不是做任何事情。
Solved the issue, I was using an outdated version of node as I was using node v16.13.2 so I tried switching to the most latest version (v17.4.0 as of now) and it works like a charm now.解决了这个问题,我在使用 node v16.13.2 时使用的是过时的 node 版本,所以我尝试切换到最新版本(截至目前为 v17.4.0),它现在就像一个魅力。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.