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

Can't Install better-sqlite3 on Centos 7 #648

Closed
Batur123 opened this issue Jun 26, 2021 · 6 comments
Closed

Can't Install better-sqlite3 on Centos 7 #648

Batur123 opened this issue Jun 26, 2021 · 6 comments

Comments

@Batur123
Copy link

Batur123 commented Jun 26, 2021

I can't install better-sqlite3

npm install better-sqlite3
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'hawk@0.10.2',
npm WARN EBADENGINE   required: { node: '0.8.x' },
npm WARN EBADENGINE   current: { node: 'v16.4.0', npm: '7.18.1' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'hoek@0.7.6',
npm WARN EBADENGINE   required: { node: '0.8.x' },
npm WARN EBADENGINE   current: { node: 'v16.4.0', npm: '7.18.1' }
npm WARN EBADENGINE }
npm ERR! code 1
npm ERR! path /home/irc4skrbt/node_modules/better-sqlite3
npm ERR! command failed
npm ERR! command sh -c prebuild-install || npm run build-release
npm ERR! > better-sqlite3@7.4.1 build-release
npm ERR! > node-gyp rebuild --release
npm ERR!
npm ERR! make: Entering directory `/home/irc4skrbt/node_modules/better-sqlite3/build'
npm ERR!   TOUCH b857c92884e9598d609f6be182a2595df7a8e00f.intermediate
npm ERR!   ACTION deps_sqlite3_gyp_locate_sqlite3_target_extract_sqlite3 b857c92884e9598d609f6be182a2595df7a8e00f.intermediate
npm ERR!   TOUCH Release/obj.target/deps/locate_sqlite3.stamp
npm ERR!   CC(target) Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o
npm ERR!   AR(target) Release/obj.target/deps/sqlite3.a
npm ERR!   COPY Release/sqlite3.a
npm ERR!   CXX(target) Release/obj.target/better_sqlite3/src/better_sqlite3.o
npm ERR! rm b857c92884e9598d609f6be182a2595df7a8e00f.intermediate
npm ERR! make: Leaving directory `/home/irc4skrbt/node_modules/better-sqlite3/build'
npm ERR! prebuild-install WARN install /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /home/irc4skrbt/node_modules/better-sqlite3/build/Release/better_sqlite3.node)
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.4.0 | linux | x64
npm ERR! gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
npm ERR! gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
npm ERR! (node:15153) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn /usr/bin/python2
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/home/irc4skrbt/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/irc4skrbt/node_modules/better-sqlite3/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/irc4skrbt/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/irc4skrbt/.node-gyp/16.4.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/home/irc4skrbt/.node-gyp/16.4.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/home/irc4skrbt/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/irc4skrbt/.node-gyp/16.4.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/irc4skrbt/node_modules/better-sqlite3',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! g++: error: unrecognized command line option '-std=c++14'
npm ERR! g++: error: unrecognized command line option '-std=gnu++14'
npm ERR! make: *** [Release/obj.target/better_sqlite3/src/better_sqlite3.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/home/irc4skrbt/node_modules/node-gyp/lib/build.js:262:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Linux 3.10.0-1127.el7.x86_64
npm ERR! gyp ERR! command "/home/irc4skrbt/.nvm/versions/node/v16.4.0/bin/node" "/home/irc4skrbt/node_modules/.bin/node-gyp" "rebuild" "--release"
npm ERR! gyp ERR! cwd /home/irc4skrbt/node_modules/better-sqlite3
npm ERR! gyp ERR! node -v v16.4.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/irc4skrbt/.npm/_logs/2021-06-26T11_39_03_172Z-debug.log
@Prinzhorn
Copy link
Contributor

npm ERR! gyp info using node-gyp@3.8.0

That's very old.

https://github.com/JoshuaWise/better-sqlite3/blob/master/docs/troubleshooting.md

@ZaidaZadkiel
Copy link

i had luck upgrading the entire system and finally upgrading c++
the error mentions std=c++14 is not available, and gcc version in default centos 7 is old

https://linuxize.com/post/how-to-install-gcc-compiler-on-centos-7/

@Batur123
Copy link
Author

i had luck upgrading the entire system and finally upgrading c++
the error mentions std=c++14 is not available, and gcc version in default centos 7 is old

https://linuxize.com/post/how-to-install-gcc-compiler-on-centos-7/

Installed older version of Better-SQLite3. It now works. Latest versions don't work properly on centos 7.

@ajayyy
Copy link

ajayyy commented Jul 16, 2021

Updating to the latest version worked for me.

@Batur123
Copy link
Author

Batur123 commented Dec 23, 2021

Found the solution after months, GCC versions are not (sometimes) compatible with Better-SQLite3 in Centos7. GCC 4.8.5 wont work in Centos 7 if you are trying to install Better-SQLite3.

If you are on Centos 7, make sure you have ROOT privileges.

sudo yum install centos-release-scl
sudo yum install devtoolset-7-gcc*
scl enable devtoolset-7 bash
gcc --version

This will install the GCC 8.3.1 and errors will be gone.

Errors related to this issue;
1-) glibcxx_3.4.20 couldn't found
2-) bindings.js error
3-) unrecognized command line option "'-std=gnu++17'"

Automatic enable everytime you restart server;

scl enable devtoolset-8 -- bash

Enable DevToolSet8

source scl_source enable devtoolset-8

@JoshuaWise
Copy link
Member

Thanks @Batur123

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

No branches or pull requests

5 participants