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

Install fails if python is not installed #209

Closed
mskri opened this issue Aug 21, 2023 · 4 comments
Closed

Install fails if python is not installed #209

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

Comments

@mskri
Copy link
Contributor

mskri commented Aug 21, 2023

After updating to [email protected] when trying to install knip in an environment (i.e. docker) where you don't have python installed you get an error. The readme doesn't seem to indicate that having python installed is a requirement. Not sure if this is a bug report or a request to update the readme?

Log example

 .../node_modules/tree-sitter-bash install$ prebuild-install || node-gyp rebuild
 .../node_modules/tree-sitter install$ prebuild-install || node-gyp rebuild
 .../node_modules/tree-sitter-bash install: prebuild-install warn install No prebuilt binaries found (target=18.17.1 runtime=node arch=x64 libc= platform=linux)
 .../node_modules/tree-sitter-bash install: gyp info it worked if it ends with ok
 .../node_modules/tree-sitter-bash install: gyp info using [email protected]
 .../node_modules/tree-sitter-bash install: gyp info using [email protected] | linux | x64
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python Python is not set from command line or npm configuration
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python Python is not set from environment variable PYTHON
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python checking if "python3" can be used
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python - "python3" is not in PATH or produced an error
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python checking if "python" can be used
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python - "python" is not in PATH or produced an error
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python **********************************************************
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python You need to install the latest version of Python.
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python you can try one of the following options:
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python   (accepted by both node-gyp and npm)
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python - Set the environment variable PYTHON
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python - Set the npm configuration variable python:
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python For more information consult the documentation at:
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python **********************************************************
 .../node_modules/tree-sitter-bash install: gyp ERR! find Python
 .../node_modules/tree-sitter-bash install: gyp ERR! configure error
 .../node_modules/tree-sitter-bash install: gyp ERR! stack Error: Could not find any Python installation to use
@webpro
Copy link
Collaborator

webpro commented Aug 21, 2023

That's a bit of a surprise. I've replaced bash-parser with tree-sitter-node + tree-sitter-bash in v2.19.6. Didn't notice this in their docs and this wasn't clear to me when adding it to Knip.

I've opened tree-sitter/tree-sitter-bash#188 over there, maybe it's just an overlook with their v0.20.0 release (I could downgrade to v0.19.0 if necessary).

@webpro
Copy link
Collaborator

webpro commented Aug 21, 2023

@webpro
Copy link
Collaborator

webpro commented Aug 21, 2023

I've downgraded the dependency in v2.19.8 so we don't need to wait it out. It should fix the issue, let me know if that's not the case.

@webpro webpro closed this as completed Aug 21, 2023
@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.

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

2 participants