tree-sitter/tree-sitter-agda

Failed to load a language-agda package grammar

zraffer opened this issue · 5 comments

In fresh install of Atom Beta 1.47 featuring Electron 5.0.
language-agda complains about tree-sitter build v47 vs. v70.
However it is v70 being actually loaded:
.atom/.apm/_prebuilds/c5e98d-tree-sitter-agda-v1.2.1-electron-v70-linux-x64.tar.gz

Atom: 1.47.0-beta0 x64
Electron: 5.0.13
OS: Ubuntu 20.04
Thrown From: language-agda package 1.2.0

Stack Trace

Failed to load a language-agda package grammar

At The module '/home/user/.atom/packages/language-agda/node_modules/tree-sitter-agda/build/Release/tree_sitter_agda_binding.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 47. This version of Node.js requires
NODE_MODULE_VERSION 70. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`). in /home/user/.atom/packages/language-agda/grammars/tree-sitter-agda.cson

Error: The module '/home/user/.atom/packages/language-agda/node_modules/tree-sitter-agda/build/Release/tree_sitter_agda_binding.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 47. This version of Node.js requires
NODE_MODULE_VERSION 70. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at process.func [as dlopen] (electron/js2c/asar.js:138:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:881:18)
    at Object.func [as .node] (electron/js2c/asar.js:138:31)
    at Module.load (internal/modules/cjs/loader.js:701:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:633:12)
    at Function.Module._load (internal/modules/cjs/loader.js:625:3)
    at Module.require (/app.asar/static/index.js:72:46)
    at require (/usr/share/atom-beta/resources/app/static/<embedded>:11:146766)
    at /packages/language-agda/node_modules/tree-sitter-agda/index.js:2:20)
    at /packages/language-agda/node_modules/tree-sitter-agda/index.js:15:3)
    at Module.get_Module._compile (/usr/share/atom-beta/resources/app/static/<embedded>:11:147450)
    at Object.value [as .js] (/usr/share/atom-beta/resources/app/static/<embedded>:11:150998)
    at Module.load (internal/modules/cjs/loader.js:701:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:633:12)
    at Function.Module._load (internal/modules/cjs/loader.js:625:3)
    at Module.require (/app.asar/static/index.js:72:46)
    at require (internal/modules/cjs/helpers.js:14:16)
    at customRequire (/usr/share/atom-beta/resources/app/static/<embedded>:1:695413)
    at new TreeSitterGrammar (/usr/share/atom-beta/resources/app/static/<embedded>:11:3113290)
    at GrammarRegistry.createGrammar (/usr/share/atom-beta/resources/app/static/<embedded>:11:360129)
    at /usr/share/atom-beta/resources/app/static/<embedded>:11:359970
    at /usr/share/atom-beta/resources/app/static/<embedded>:11:581856
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:54:3)
  at /packages/language-agda/grammars/tree-sitter-agda.cson:1:1

Commands

     -0:30.2.0 window:toggle-menu-bar (div.welcome.is-guide)

Non-Core Packages

language-agda 1.2.0 

In release version of atom the error have changed

Installing “language-agda@1.2.0” failed.Hide output…

> tree-sitter-agda@1.3.0 install /tmp/apm-install-dir-2020420-6297-10ry0kc.femm/node_modules/language-agda/node_modules/tree-sitter-agda
> prebuild-install || npx node-gyp rebuild


prebuild-install WARN install No prebuilt binaries found (target=5.0.13 runtime=electron arch=x64 libc= platform=linux)
sh: 1: npx: not found
npm WARN enoent ENOENT: no such file or directory, open '/tmp/apm-install-dir-2020420-6297-10ry0kc.femm/package.json'
npm WARN apm-install-dir-2020420-6297-10ry0kc.femm No description
npm WARN apm-install-dir-2020420-6297-10ry0kc.femm No repository field.
npm WARN apm-install-dir-2020420-6297-10ry0kc.femm No README data
npm WARN apm-install-dir-2020420-6297-10ry0kc.femm No license field.

npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! tree-sitter-agda@1.3.0 install: `prebuild-install || npx node-gyp rebuild`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the tree-sitter-agda@1.3.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/user/.atom/.apm/_logs/2020-05-20T13_26_39_635Z-debug.log

As far as I have found another closed issue I have managed to install the plugin after additional installation of nodejs. However it is nasty thing. I should mention that all (all?) the previous versions of tree-sitter-agda did not require the global nodejs but have made usage of the Atom's built-in instance of npm/npx. Can the last build of this repo be fixed to allow its installation into the bare Atom Editor without additional global NodeJS installation?

Sorry I don't have the time to take care of these issues recently 😔

I thought I could solved this kind of problems by pre-building these stuff in every release.
But that means I'll have to release updates to keep up with the environment, and that's not a good solution at all.

I think I have been doing these things the wrong way, because other tree-sitter parsers don't seem to be suffering the same issue. But I simply doesn't have the time fix this at the moment 😭

"Oh, No!" 😢
However at least it is working with Node.
Perhaps the Node should be noted in README as prerequisite for installation?

Also, can the TreeSitter 🎎 team provide any consulting?