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

Build failure with node 17 #102

Closed
rien opened this issue Feb 18, 2022 · 6 comments
Closed

Build failure with node 17 #102

rien opened this issue Feb 18, 2022 · 6 comments

Comments

@rien
Copy link

rien commented Feb 18, 2022

Installing the tree-sitter using node version 17.4.0 with npm seem to fail with the following errors:

npm ERR! In file included from ../src/binding.cc:1:
npm ERR! /home/rien/.cache/node-gyp/17.4.0/include/node/node.h:843:7: warning: cast between incompatible function types from ‘void (*)(v8::Local<v8::Object>)’ to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
npm ERR!   843 |       (node::addon_register_func) (regfunc),                          \
npm ERR!       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! /home/rien/.cache/node-gyp/17.4.0/include/node/node.h:877:3: note: in expansion of macro ‘NODE_MODULE_X’
npm ERR!   877 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
npm ERR!       |   ^~~~~~~~~~~~~
npm ERR! ../src/binding.cc:25:1: note: in expansion of macro ‘NODE_MODULE’
npm ERR!    25 | NODE_MODULE(tree_sitter_runtime_binding, InitAll)
npm ERR!       | ^~~~~~~~~~~
npm ERR! ../src/conversions.cc: In function ‘void node_tree_sitter::InitConversions(v8::Local<v8::Object>)’:
npm ERR! ../src/conversions.cc:31:118: error: no matching function for call to ‘v8::ArrayBuffer::New(v8::Isolate*, uint32_t*&, long unsigned int)’
npm ERR!    31 |   auto js_point_transfer_buffer = ArrayBuffer::New(Isolate::GetCurrent(), point_transfer_buffer, 2 * sizeof(uint32_t));
npm ERR!       |                                                                                                                      ^
npm ERR! In file included from /home/rien/.cache/node-gyp/17.4.0/include/node/v8.h:25,
npm ERR!                  from /home/rien/.cache/node-gyp/17.4.0/include/node/node.h:63,
npm ERR!                  from ../../nan/nan.h:58,
npm ERR!                  from ../src/./node.h:4,
npm ERR!                  from ../src/conversions.cc:1:
npm ERR! /home/rien/.cache/node-gyp/17.4.0/include/node/v8-array-buffer.h:198:29: note: candidate: ‘static v8::Local<v8::ArrayBuffer> v8::ArrayBuffer::New(v8::Isolate*, size_t)’
npm ERR!   198 |   static Local<ArrayBuffer> New(Isolate* isolate, size_t byte_length);
npm ERR!       |                             ^~~
npm ERR! /home/rien/.cache/node-gyp/17.4.0/include/node/v8-array-buffer.h:198:29: note:   candidate expects 2 arguments, 3 provided
npm ERR! /home/rien/.cache/node-gyp/17.4.0/include/node/v8-array-buffer.h:212:29: note: candidate: ‘static v8::Local<v8::ArrayBuffer> v8::ArrayBuffer::New(v8::Isolate*, std::shared_ptr<v8::BackingStore>)’
npm ERR!   212 |   static Local<ArrayBuffer> New(Isolate* isolate,
npm ERR!       |                             ^~~
npm ERR! /home/rien/.cache/node-gyp/17.4.0/include/node/v8-array-buffer.h:212:29: note:   candidate expects 2 arguments, 3 provided
npm ERR! make: *** [tree_sitter_runtime_binding.target.mk:127: Release/obj.target/tree_sitter_runtime_binding/src/conversions.o] Error 1

This is not the case when using node 16.

@rien rien changed the title Build failure with node 17 Build failure with node 17 and npm Feb 18, 2022
@danielo515
Copy link

I can confirm this happens for node 18 too. Is there any workaround?

@botbotty
Copy link

Same issue for node 17.0.1 and npm 8.1.0

@rien rien changed the title Build failure with node 17 and npm Build failure with node 17 Jul 13, 2022
@sguilliaci
Copy link

Same issue with node 18.10 on macOS

@leElvyn
Copy link

leElvyn commented Oct 18, 2022

Same issue with node 18.10 on linux

@Vssblt
Copy link

Vssblt commented Oct 24, 2022

Same issue with node 18.7.0 on ubuntu 22.10.

@rien
Copy link
Author

rien commented Nov 8, 2022

This seems to be resolved with the update to 0.20.1, thanks!

@rien rien closed this as completed Nov 8, 2022
jonorthwash added a commit to jonorthwash/syntax-highlighter that referenced this issue Jan 14, 2023
Old versions of tree-sitter don't build with recent versions of node:
tree-sitter/node-tree-sitter#102
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants