tree-sitter / tree-sitter-haskell

Haskell grammar for tree-sitter.
MIT License
151 stars 36 forks source link

Can't npm install tree-sitter-haskell on Mac M3 Node.js v20.10? #110

Closed termhare closed 3 months ago

termhare commented 7 months ago
(base) $ pnpm add tree-sitter-haskell
node_modules/.pnpm/tree-sitter-haskell@0.13.0/node_modules/tree-sitter-haskell: Running install script, failed in 12s
.../node_modules/tree-sitter-haskell install$ node-gyp rebuild
│ gyp info it worked if it ends with ok
│ gyp info using node-gyp@9.4.0
│ gyp info using node@20.10.0 | darwin | arm64
│ gyp info find Python using Python version 3.11.4 found at "/Users/lancepollard/anaconda3/bin/python3"
│ gyp info spawn /Users/lancepollard/anaconda3/bin/python3
│ gyp info spawn args [
│ gyp info spawn args   '/Users/lancepollard/Library/pnpm/global/5/.pnpm/pnpm@8.10.0/node_modules/pnpm/dist/node_modules/node-gyp/gyp/g…
│ gyp info spawn args   'binding.gyp',
│ gyp info spawn args   '-f',
│ gyp info spawn args   'make',
│ gyp info spawn args   '-I',
│ gyp info spawn args   '/Users/lancepollard/start/termsurf/deck/task/node_modules/.pnpm/tree-sitter-haskell@0.13.0/node_modules/tree-s…
│ gyp info spawn args   '-I',
│ gyp info spawn args   '/Users/lancepollard/Library/pnpm/global/5/.pnpm/pnpm@8.10.0/node_modules/pnpm/dist/node_modules/node-gyp/addon…
│ gyp info spawn args   '-I',
│ gyp info spawn args   '/Users/lancepollard/Library/Caches/node-gyp/20.10.0/include/node/common.gypi',
│ gyp info spawn args   '-Dlibrary=shared_library',
│ gyp info spawn args   '-Dvisibility=default',
│ gyp info spawn args   '-Dnode_root_dir=/Users/lancepollard/Library/Caches/node-gyp/20.10.0',
│ gyp info spawn args   '-Dnode_gyp_dir=/Users/lancepollard/Library/pnpm/global/5/.pnpm/pnpm@8.10.0/node_modules/pnpm/dist/node_modules…
│ gyp info spawn args   '-Dnode_lib_file=/Users/lancepollard/Library/Caches/node-gyp/20.10.0/<(target_arch)/node.lib',
│ gyp info spawn args   '-Dmodule_root_dir=/Users/lancepollard/start/termsurf/deck/task/node_modules/.pnpm/tree-sitter-haskell@0.13.0/n…
│ gyp info spawn args   '-Dnode_engine=v8',
│ gyp info spawn args   '--depth=.',
│ gyp info spawn args   '--no-parallel',
│ gyp info spawn args   '--generator-output',
│ gyp info spawn args   'build',
│ gyp info spawn args   '-Goutput_dir=.'
│ gyp info spawn args ]
│ gyp info spawn make
│ gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
│   CC(target) Release/obj.target/tree_sitter_haskell_binding/src/parser.o
│   CXX(target) Release/obj.target/tree_sitter_haskell_binding/src/binding.o
│ In file included from ../src/binding.cc:3:
│ ../../../../nan@2.18.0/node_modules/nan/nan.h:688:39: warning: 'IdleNotificationDeadline' is deprecated: Use MemoryPressureNotificati…
│     return v8::Isolate::GetCurrent()->IdleNotificationDeadline(
│                                       ^
│ /Users/lancepollard/Library/Caches/node-gyp/20.10.0/include/node/v8-isolate.h:1291:3: note: 'IdleNotificationDeadline' has been expli…
│   V8_DEPRECATE_SOON(
│   ^
│ /Users/lancepollard/Library/Caches/node-gyp/20.10.0/include/node/v8config.h:550:39: note: expanded from macro 'V8_DEPRECATE_SOON'
│ # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
│                                       ^
│ ../src/binding.cc:13:11: error: no template named 'Handle'
│ void Init(Handle<Object> exports, Handle<Object> module) {
│           ^
│ ../src/binding.cc:13:35: error: no template named 'Handle'
│ void Init(Handle<Object> exports, Handle<Object> module) {
│                                   ^
│ ../src/binding.cc:18:50: error: too few arguments to function call, single argument 'context' was not specified
│   Local<Function> constructor = tpl->GetFunction();
│                                 ~~~~~~~~~~~~~~~~ ^
│ /Users/lancepollard/Library/Caches/node-gyp/20.10.0/include/node/v8-template.h:497:46: note: 'GetFunction' declared here
│   V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
│                                              ^
│ ../src/binding.cc:18:19: error: no viable conversion from 'MaybeLocal<Function>' to 'Local<Function>'
│   Local<Function> constructor = tpl->GetFunction();
│                   ^             ~~~~~~~~~~~~~~~~~~
│ /Users/lancepollard/Library/Caches/node-gyp/20.10.0/include/node/v8-local-handle.h:190:7: note: candidate constructor (the implicit c…
│ class Local {
│       ^
│ /Users/lancepollard/Library/Caches/node-gyp/20.10.0/include/node/v8-local-handle.h:190:7: note: candidate constructor (the implicit m…
│ /Users/lancepollard/Library/Caches/node-gyp/20.10.0/include/node/v8-local-handle.h:195:13: note: candidate template ignored: could no…
│   V8_INLINE Local(Local<S> that) : val_(reinterpret_cast<T*>(*that)) {
│             ^
│ /Users/lancepollard/Library/Caches/node-gyp/20.10.0/include/node/v8-local-handle.h:331:22: note: explicit constructor is not a candid…
│   explicit V8_INLINE Local(T* that) : val_(that) {}
│                      ^
│ ../src/binding.cc:22:13: error: no matching member function for call to 'Set'
│   instance->Set(Nan::New("name").ToLocalChecked(), Nan::New("haskell").ToLocalChecked());
│   ~~~~~~~~~~^~~
│ /Users/lancepollard/Library/Caches/node-gyp/20.10.0/include/node/v8-object.h:246:37: note: candidate function not viable: requires 3 …
│   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
│                                     ^
│ /Users/lancepollard/Library/Caches/node-gyp/20.10.0/include/node/v8-object.h:249:37: note: candidate function not viable: requires 3 …
│   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
│                                     ^
│ 1 warning and 5 errors generated.
│ make: *** [Release/obj.target/tree_sitter_haskell_binding/src/binding.o] Error 1
│ gyp ERR! build error
│ gyp ERR! stack Error: `make` failed with exit code: 2
│ gyp ERR! stack     at ChildProcess.onExit (/Users/lancepollard/Library/pnpm/global/5/.pnpm/pnpm@8.10.0/node_modules/pnpm/dist/node_mo…
│ gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
│ gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
│ gyp ERR! System Darwin 23.1.0
│ gyp ERR! command "/Users/lancepollard/Library/pnpm/nodejs/20.10.0/bin/node" "/Users/lancepollard/Library/pnpm/global/5/.pnpm/pnpm@8.1…
│ gyp ERR! cwd /Users/lancepollard/start/termsurf/deck/task/node_modules/.pnpm/tree-sitter-haskell@0.13.0/node_modules/tree-sitter-hask…
│ gyp ERR! node -v v20.10.0
│ gyp ERR! node-gyp -v v9.4.0
│ gyp ERR! not ok
 ELIFECYCLE  Command failed with exit code 1.
tek commented 7 months ago

I guess that's because the version in the central npm repo is super old, see https://github.com/tree-sitter/tree-sitter-haskell/pull/29#issuecomment-1865951565