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

Build failure with node 17

Open rien opened this issue 4 years ago • 2 comments

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 avatar Feb 18 '22 17:02 rien

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

danielo515 avatar Jun 01 '22 07:06 danielo515

Same issue for node 17.0.1 and npm 8.1.0

botbotty avatar Jun 28 '22 07:06 botbotty

Same issue with node 18.10 on macOS

sguilliaci avatar Oct 06 '22 14:10 sguilliaci

Same issue with node 18.10 on linux

leElvyn avatar Oct 18 '22 14:10 leElvyn

Same issue with node 18.7.0 on ubuntu 22.10.

Vssblt avatar Oct 24 '22 06:10 Vssblt

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

rien avatar Nov 08 '22 16:11 rien