Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
291 views
in Technique[技术] by (71.8m points)

node.js - 使用Tree-Sitter的Atom语言包(Atom language package using tree-sitter)

I followed this tutorial on how to create Tree-sitter parser.

(我按照教程介绍了如何创建Tree-sitter解析器。)

I published the parser to npm.

(我将解析器发布到npm。)

Then created Atom language-package that uses my tree-sitter module using this guide.

(然后使用指南创建使用我的tree-sitter模块的Atom语言包。)

When I reload Atom editor, I get the following error:

(重新加载Atom编辑器时,出现以下错误:)

(...path to my tree-sitter module...) was compiled against a different Node.js version using NODE_MODULE_VERSION 72. This version of Node.js requires NODE_MODULE_VERSION 69. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install )

((...我的树发送器模块的路径...)是使用NODE_MODULE_VERSION 72针对其他Node.js版本进行编译的。此版本的Node.js需要NODE_MODULE_VERSION69。请尝试重新编译或重新安装该模块(例如,使用npm rebuildnpm install ))

So I followed the advice in the error window and tried npm rebuild or npm install, but I cannot get over this error.

(所以我按照错误窗口中的建议尝试了npm rebuild或npm install,但是我无法克服此错误。)

notes:

(笔记:)

npm -v
6.12.1
node -v
12.13.1
atom -v
1.41.0
  ask by Tracy Applepie translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I tried completely different approach to my problem:

(我尝试了完全不同的方法来解决我的问题:)

I generated Tree-sitter parser as an Atom package, therefore it is set in "node environment" used by Atom editor not mine (I hope I understand the problem correctly).

(我将Tree-sitter解析器作为Atom软件包生成,因此它是在Atom编辑器使用的“节点环境”中设置的,而不是我的(我希望我正确理解了这个问题)。)

I just added grammar.js file to the package and then followed the tree-sitter guide I linked in my question (only without nmp init - I preserved package.json generated by Atom package generate).

(我只是将grammar.js文件添加到程序包中,然后按照我在问题中链接的tree-sitter指南进行操作(仅不使用nmp init-我保留了由Atom程序包generate生成的package.json )。)

Then I created my language package as in the Atom grammar tutorial I included in my post.I added dependency for my parser and also ran npm link in parser directory and npm link PARSER_PACKAGE_NAME and npm i in the package directory.

(然后,我建立了我的语言包是在Atom语法教程中,我包括在我post.I添加依赖我的解析器和也跑解析器目录和NPM链接PARSER_PACKAGE_NAME NPM链接NPM我包目录。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...