Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The module was compiled against a different Node.js version #797

Closed
Skittles3920 opened this issue Apr 27, 2022 · 11 comments
Closed

The module was compiled against a different Node.js version #797

Skittles3920 opened this issue Apr 27, 2022 · 11 comments

Comments

@Skittles3920
Copy link

Unhandled promise rejection: Error: The module '/home/container/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 102. Please try re-compiling or re-installing the module (for instance, using npm rebuildornpm install)

Ive been trying to start my bot using pterodactyl panel and ive been getting this error, when running it on my pc or as a normal node process on my vps it runs just fine. Any ideas?

@Skittles3920 Skittles3920 changed the title The module was compiled against a different Node.js The module was compiled against a different Node.js version Apr 27, 2022
@Prinzhorn
Copy link
Contributor

Prinzhorn commented Apr 27, 2022

Please try re-compiling or re-installing the module (for instance, using npm rebuildornpm install

I assume this didn't fix it? You are probably copying node_modules around.

@Skittles3920
Copy link
Author

the commands didnt fix it no. Any suggestions how i can fix?

@Prinzhorn
Copy link
Contributor

Prinzhorn commented Apr 28, 2022

I'm sure the solution is in here somewhere: https://github.com/JoshuaWise/better-sqlite3/search?q=The+module+was+compiled+against+a+different+Node.js+version&type=issues This is not an issue with better-sqlite3, you must be doing something wrong with how you install/build your packages.

@cryptotester
Copy link

cryptotester commented May 3, 2022

Hi, using node 18.0.0 installed via nvm on Fedora Linux, getting this error too:

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

I did remove my node_modulesand run yarn again (to reinstall all packages), same issue.

SOLUTION: switching to node v16.x LTS worked for me. I use nvm to manage this kind of issues, in my case I did run:

nvm use lts/* which installed v16.15.0

It would be nice though, that this program works also on newer versions such as v18...

@Prinzhorn
Copy link
Contributor

Prinzhorn commented May 3, 2022

I assume the wrong prebuilds are currently installed (instead of failing the prebuild), see #800

@JoshuaWise
Copy link
Member

It would be nice though, that this program works also on newer versions such as v18...

Node.js v18 has been out for all of two weeks. Support will come soon.

@Regradert
Copy link

I'm sorry for my behavior JoshuaWise, it's just that I've gotten a bit burnt. I feel the shapes.

My current node version is v16.15.0, so that message that appears to me is very strange.

My apologies and I hope you have not taken it the wrong way.

@Regradert
Copy link

JoshuaWise I installed node version 16.1.0 and miraculously it worked!! I can now connect to the database. Please, if you can delete my previous thread #805 I don't want to stain your work, I hope you have excused me.

@m4heshd
Copy link
Contributor

m4heshd commented May 7, 2022

@Regradert Even though you wrote a huge rant there, you never mentioned you were trying to build against Electron v18. Module version 103 is reserved by Electron for version 18. Usually people who work with Electron a lot, are familiar with these module versions. Next time please make yourself familiar with the environment you're working on by reading stuff like this documentation. You would've been introduced to this thread if you made it clear there.

What happened was, you kept building the addon for your locally installed Node.js and kept trying to run that on Electron v18. Two different environments. All you had to do was search for what those versions meant. My suggestion is to use something like electron-builder which supports building native addons against the Electron version used by your project. Command is electron-builder install-app-deps. Simple as that.

@JoshuaWise can we get #126 pinned again? It's buried deep in old issues.

@Regradert
Copy link

@m4heshd Thank you very much !! I wish I had found it sooner, that thread has helped me a lot.

@JoshuaWise
Copy link
Member

Closing this as it's not really an issue with better-sqlite3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants