node-tree-sitter icon indicating copy to clipboard operation
node-tree-sitter copied to clipboard

Install fails with Node v23, due to `-std=c++17`.

Open magnusriga opened this issue 9 months ago • 8 comments

Would it be possible to update binding.gyp, from -std=c++17 to -std=c++20 (or higher)?

A minimum of C++20 is required in Node 23:

https://github.com/nodejs/node/blob/9d2368f64329bf194c4e82b349e76fdad879d32a/deps/v8/include/v8config.h#L13

Without it, building tree-sitter will fail.

magnusriga avatar Mar 01 '25 21:03 magnusriga

this should be easily solved in changing in binding.gyp all c++17 to c++20 @amaanq

gpetrov avatar Mar 04 '25 15:03 gpetrov

But note that upgrading the C++ std version can prevent usage with older OS/compilers and versions of Node.js... This is something/another thing Node.js/v8 doesn't handle that well IMHO...

segevfiner avatar May 22 '25 11:05 segevfiner

I forked and released my own version, which fixes existing issues and works fine. I hope it helps.

https://www.npmjs.com/package/@keqingmoe/tree-sitter

KeqingMoe avatar Oct 17 '25 02:10 KeqingMoe

Hi, I don't know which older node versions you support but for these parts:

https://github.com/tree-sitter/node-tree-sitter/blob/c84d48d35d06d540cef0e3381c12b079c64454a1/binding.gyp#L27-L47

Why don't you just use the default configuration from node's common.gypi? If you use that, the nodejs install will supply the c++ version.

Abrifq avatar Oct 21 '25 08:10 Abrifq

Why don't you just use the default configuration from node's common.gypi? If you use that, the nodejs install will supply the c++ version.

Nevermind, looks like node doesn't have a proper version in their config.gypi and common.gypi.

Abrifq avatar Oct 21 '25 08:10 Abrifq

Nevermind, looks like node doesn't have a proper version in their config.gypi and common.gypi.

😅 I realized I could run a diff between versions... and yeah, there is a difference: node_module_version variable changes across versions!

nodejs version node_module_version
22 127
23 131
24 137

I didn't notice before because I was looking between 22 & 24, which had only one digit change. Sorry!

Abrifq avatar Oct 21 '25 08:10 Abrifq