Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot be installed on linux due to binary dependencies #211

Closed
Raynos opened this issue Aug 21, 2023 · 11 comments
Closed

Cannot be installed on linux due to binary dependencies #211

Raynos opened this issue Aug 21, 2023 · 11 comments
Labels
bug Something isn't working

Comments

@Raynos
Copy link

Raynos commented Aug 21, 2023

$ npm i knip -g
npm ERR! code 1
npm ERR! path /home/raynos/projects/nvm/versions/node/v18.16.1/lib/node_modules/knip/node_modules/tree-sitter-bash
npm ERR! command failed
npm ERR! command sh -c prebuild-install || node-gyp rebuild
npm ERR! make: Entering directory '/home/raynos/projects/nvm/versions/node/v18.16.1/lib/node_modules/knip/node_modules/tree-sitter-bash/build'
npm ERR!   CC(target) Release/obj.target/tree_sitter_bash_binding/src/parser.o
npm ERR!   CXX(target) Release/obj.target/tree_sitter_bash_binding/bindings/node/binding.o
npm ERR! make: Leaving directory '/home/raynos/projects/nvm/versions/node/v18.16.1/lib/node_modules/knip/node_modules/tree-sitter-bash/build'
npm ERR! prebuild-install warn install No prebuilt binaries found (target=18.16.1 runtime=node arch=x64 libc= platform=linux)
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] | linux | x64
npm ERR! gyp info find Python using Python version 3.10.12 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/home/raynos/projects/nvm/versions/node/v18.16.1/lib/node_modules/npm/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   '/home/raynos/projects/nvm/versions/node/v18.16.1/lib/node_modules/knip/node_modules/tree-sitter-bash/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/raynos/projects/nvm/versions/node/v18.16.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/raynos/.cache/node-gyp/18.16.1/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=/home/raynos/.cache/node-gyp/18.16.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/home/raynos/projects/nvm/versions/node/v18.16.1/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/raynos/.cache/node-gyp/18.16.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/raynos/projects/nvm/versions/node/v18.16.1/lib/node_modules/knip/node_modules/tree-sitter-bash',
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! In file included from ../src/parser.c:1:
npm ERR! ../src/parser.c: In function ‘ts_lex_keywords’:
npm ERR! ../src/tree_sitter/parser.h:135:8: warning: variable ‘eof’ set but not used [-Wunused-but-set-variable]
npm ERR!   135 |   bool eof = false;             \
npm ERR!       |        ^~~
npm ERR! ../src/parser.c:12592:3: note: in expansion of macro ‘START_LEXER’
npm ERR! 12592 |   START_LEXER();
npm ERR!       |   ^~~~~~~~~~~
npm ERR! make: g++-10: No such file or directory
npm ERR! make: *** [tree_sitter_bash_binding.target.mk:122: Release/obj.target/tree_sitter_bash_binding/bindings/node/binding.o] Error 127
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 (/home/raynos/projects/nvm/versions/node/v18.16.1/lib/node_modules/npm/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 ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Linux 6.2.6-76060206-generic
npm ERR! gyp ERR! command "/home/raynos/projects/nvm/versions/node/v18.16.1/bin/node" "/home/raynos/projects/nvm/versions/node/v18.16.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/raynos/projects/nvm/versions/node/v18.16.1/lib/node_modules/knip/node_modules/tree-sitter-bash
npm ERR! gyp ERR! node -v v18.16.1
npm ERR! gyp ERR! node-gyp -v v9.3.1
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/raynos/.npm/_logs/2023-08-21T15_46_25_651Z-debug-0.log

The tree sitter bash library does not compile.

@Raynos Raynos added the bug Something isn't working label Aug 21, 2023
@webpro
Copy link
Collaborator

webpro commented Aug 21, 2023

Yeah sorry about that. Duplicate of #209, let's track it over there.

@webpro webpro closed this as completed Aug 21, 2023
@Raynos
Copy link
Author

Raynos commented Aug 21, 2023

It's clearly not a duplicate because it has nothing to do with missing python and everything to do with the third party dependency not compiling due to a bug in their C++

@Raynos
Copy link
Author

Raynos commented Aug 21, 2023

It looks like they hard coded g++-10 somewhere

npm ERR! make: g++-10: No such file or directory

And because I don't have g++-10 on my laptop I cannot compile this third party depedency.

@Raynos
Copy link
Author

Raynos commented Aug 21, 2023

I should probably install 2.19.5 instead because it does not have the broken third party dependency.

@webpro
Copy link
Collaborator

webpro commented Aug 21, 2023

I should probably install 2.19.5 instead because it does not have the broken third party dependency.

Yes.

I'm thinking about downgrading tree-sitter-bash to v0.19.0 but that will likely not help you here either.

@webpro webpro reopened this Aug 21, 2023
@webpro
Copy link
Collaborator

webpro commented Aug 21, 2023

You might want to try v2.19.8 with the downgraded 3rd party dep.

@sbason
Copy link

sbason commented Aug 21, 2023

We have this same issue and v2.19.8 does not fix it I'm afraid. The newest version that works is v2.19.5.

@webpro
Copy link
Collaborator

webpro commented Aug 22, 2023

It's clearly not a duplicate because it has nothing to do with missing python and everything to do with the third party dependency not compiling due to a bug in their C++

Sorry about that, read and assumed too fast that "No prebuilt binaries found" would essentially be the same issue (since the binaries are missing):

npm ERR! prebuild-install warn install No prebuilt binaries found (target=18.16.1 runtime=node arch=x64 libc= platform=linux)

tree-sitter-bash v0.19.0 has this list of binaries: https://github.com/tree-sitter/tree-sitter-bash/releases/tag/v0.19.0. Not sure what's missing that would match your environment(s)?

Wanted to get rid of an ancient dependency. Also see #72. The tree-sitter replacement works slightly better than bash-parser, so I don't fancy reverting, which would be a breaking change again.

@Raynos
Copy link
Author

Raynos commented Aug 23, 2023

None of those prebuilt binaries have anything to do with prebuild-install ( https://github.com/tree-sitter/tree-sitter-bash/blob/master/bindings/node/index.js ).

If you look at https://www.npmjs.com/package/leveldown?activeTab=code it has the binaries in the npm package.

If you look at https://www.npmjs.com/package/tree-sitter-bash?activeTab=code you will see zero binaries in the npm tarball.

The package author of tree-sitter-bash has to change their npm publish strategy ( see https://github.com/Level/leveldown/blob/master/.github/workflows/release.yml as reference )

@webpro
Copy link
Collaborator

webpro commented Aug 23, 2023

Guess this wasn't the right time for tree-sitter yet. Reverted to bash-parser in v2.19.11.

Thanks for all the info, I will look into it and pass it through.

@webpro
Copy link
Collaborator

webpro commented Aug 25, 2023

None of those prebuilt binaries have anything to do with prebuild-install ( https://github.com/tree-sitter/tree-sitter-bash/blob/master/bindings/node/index.js ).

prebuild-install uses the prebuilt binaries in the GitHub Release by default (the script you link then uses the GitHub Release asset fetched through prebuild-install).

With linking to tree-sitter/tree-sitter-bash#188 I'm going to close this issue.

Tips & tricks still most welcome, either for preventing similar issues in the future or for alternatives.

@webpro webpro closed this as completed Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants