Comments (8)
Try building the latest version of node-tree-sitter from source. A VS Code crashing issue was fixed on master but hasn't been released yet (#109).
from node-tree-sitter.
@verhovsky Thank you for your response. After npm install
the main branch, I got the class error:
The module '/Users/yanqiaochen/node_modules/tree-sitter/build/Release/tree_sitter_runtime_binding.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 115. This version of Node.js requires
NODE_MODULE_VERSION 116. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
I've tried rm -rf node_modules
, and then npm install
, ./node_modules/.bin/electron-rebuild
as shown in https://github.com/electron/electron/blob/main/docs/tutorial/using-native-node-modules.md . Unfortunately, it doesn't work for me
from node-tree-sitter.
You did npm install tree-sitter
then
cd node_modules/tree-sitter
HOME=~/.electron-gyp node-gyp rebuild --target=1.2.3 --arch=x64 --dist-url=https://electronjs.org/headers
? What do you mean by it not working for you?
from node-tree-sitter.
Sorry for the misleading message above. I accidentally ran the debugger without installing the tree-sitter
git repository in advance. Now I am trying to install the git repo version of tree-sitter. While running npm install git+ssh://[email protected]:tree-sitter/node-tree-sitter.git
, I got a long error message.
npm ERR! code 1
npm ERR! path /Users/yanqiaochen/cs/comp/YanqiaoChen/map/node_modules/tree-sitter
npm ERR! command failed
npm ERR! command sh -c -- prebuild-install || node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info find Python using Python version 3.10.6 found at "/Users/yanqiaochen/.pyenv/versions/3.10.6/bin/python3"
npm ERR! gyp info spawn /Users/yanqiaochen/.pyenv/versions/3.10.6/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/yanqiaochen/cs/comp/YanqiaoChen/map/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 '/Users/yanqiaochen/cs/comp/YanqiaoChen/map/node_modules/tree-sitter/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/yanqiaochen/cs/comp/YanqiaoChen/map/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/yanqiaochen/Library/Caches/node-gyp/16.20.2/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=/Users/yanqiaochen/Library/Caches/node-gyp/16.20.2',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/yanqiaochen/cs/comp/YanqiaoChen/map/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/yanqiaochen/Library/Caches/node-gyp/16.20.2/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/yanqiaochen/cs/comp/YanqiaoChen/map/node_modules/tree-sitter',
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 info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! make: *** No rule to make target `Release/obj.target/tree_sitter/vendor/tree-sitter/lib/src/lib.o', needed by `Release/tree_sitter.a'. Stop.
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 (/Users/yanqiaochen/cs/comp/YanqiaoChen/map/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Darwin 22.3.0
npm ERR! gyp ERR! command "/Users/yanqiaochen/.nvm/versions/node/v16.20.2/bin/node" "/Users/yanqiaochen/cs/comp/YanqiaoChen/map/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/yanqiaochen/cs/comp/YanqiaoChen/map/node_modules/tree-sitter
npm ERR! gyp ERR! node -v v16.20.2
npm ERR! gyp ERR! node-gyp -v v9.4.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/yanqiaochen/.npm/_logs/2023-10-12T20_50_06_030Z-debug-0.log
from node-tree-sitter.
After failing to install node-tree-sitter
with npm
, I found it was possible to install with git and then compile with npm run build
. However, after I added the local tree-sitter
dependency with npm install --save ../node-tree-sitter
and recompiled the node-tree-sitter
with command HOME=~/.electron-gyp node-gyp rebuild --target=1.2.3 --arch=x64 --dist-url=https://electronjs.org/headers
, I got error msg
../src/util.cc:8:28: error: no member named 'InstanceOf' in 'v8::Value'
auto maybe_bool = value->InstanceOf(Nan::GetCurrentContext(), object);
~~~~~~~^
1 error generated.
make: *** [Release/obj.target/tree_sitter_runtime_binding/src/util.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/yanqiaochen/.nvm/versions/node/v16.20.2/lib/node_modules/node-gyp/lib/build.js:203:23)
gyp ERR! stack at ChildProcess.emit (node:events:513:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
gyp ERR! System Darwin 22.3.0
gyp ERR! command "/Users/yanqiaochen/.nvm/versions/node/v16.20.2/bin/node" "/Users/yanqiaochen/.nvm/versions/node/v16.20.2/bin/node-gyp" "rebuild" "--target=1.2.3" "--arch=x64" "--dist-url=https://electronjs.org/headers"
gyp ERR! cwd /Users/yanqiaochen/cs/comp/YanqiaoChen/node-tree-sitter
gyp ERR! node -v v16.20.2
gyp ERR! node-gyp -v v9.4.0
gyp ERR! not ok
I don't know which part did I mess up. I guess the package compilation?
from node-tree-sitter.
I uploaded the failing code to an isolated repository with a reproduction instruction. Please check it and share insight. Any help will be appreciated
from node-tree-sitter.
This issue provides a workaround to make node-tree-sitter
work on vscode extension
from node-tree-sitter.
IIUC, using the .wasm
route technically speaking makes use of something other than `node-tree-sitter.
from node-tree-sitter.
Related Issues (20)
- salt
- .
- Node module version mismatch when integrating tree-sitter with VS Code extension HOT 4
- Implicit use of wrong grammar when multiple grammar directories are present HOT 2
- electron version 19.0.17 HOT 3
- Special characters in rule names cause Uncaught SyntaxError HOT 2
- Electron error HOT 1
- BFS not working, some internal problem with cursor HOT 1
- Consider making Query matches/captures iterators
- Support for all query predicates supported by "official" tree sitter queries
- Tree.rootNode undefined in jest tests due to race condition HOT 2
- Repository name change name to tree-sitter-node HOT 2
- .
- The module 'l\node_modules\tree-sitter\build\Release\tree_sitter_runtime_binding.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 115. This version of Node.js requires NODE_MODULE_VERSION 118. Please try re-compiling or re-installing the module (for instance, using `npm rebuild` or `npm install`) HOT 3
- Can't use in VS Code extension HOT 4
- Invalid language object with tree-sitter v0.21 - caused by NAPI? HOT 4
- node siter fails when included in a react based project and webpack >5 HOT 3
- intermittent `TypeError: NodeClass is not a constructor` when getting tree nodes HOT 7
- Nonexistent property `QueryCapture.text` in typings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-tree-sitter.