tree-sitter / tree-sitter

An incremental parsing system for programming tools

Home Page:https://tree-sitter.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error[E0463]: can't find crate for `thiserror_impl`

SamuelLarkin opened this issue · comments

Problem

From README, it says to install

cargo install tree-sitter-cli

but I get a compilation error

error[E0463]: can't find crate for `thiserror_impl`
   --> $HOME/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thiserror-1.0.59/src/lib.rs:248:9
    |
248 | pub use thiserror_impl::*;
    |         ^^^^^^^^^^^^^^ can't find crate

For more information about this error, try `rustc --explain E0463`.
error: could not compile `thiserror` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `tree-sitter-cli v0.22.5`, intermediate artifacts can be found at `/tmp/cargo-installDzduiT`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Steps to reproduce

cargo install tree-sitter-cli

Expected behavior

tree-sitter installs.

Tree-sitter version (tree-sitter --version)

tree-sitter-cli v0.22.5

Operating system/version

Linux

Sometimes cargo's index can get corrupted, leading to these kinds of issues (e.g. this stackoverflow post). If you delete the ~/.cargo/registry/index directory, does the installation still fail?

Yeah I just built it fine locally on macos and on linux, using stable and nightly, it's not an issue here I'd think

I would try @WillLillis's suggestion first and see if that works

I still get the error even after deleting the registry.

rm -fr ~/.cargo/registry
cargo --version
cargo 1.76.0 (c84b36747 2024-01-18)
error[E0463]: can't find crate for `thiserror_impl`
   --> /home/larkins/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thiserror-1.0.59/src/lib.rs:248:9
    |
248 | pub use thiserror_impl::*;
    |         ^^^^^^^^^^^^^^ can't find crate

For more information about this error, try `rustc --explain E0463`.
error: could not compile `thiserror` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `tree-sitter-cli v0.22.6`, intermediate artifacts can be found at `/tmp/cargo-installfiA527`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Tried a new version of cargo

error[E0463]: can't find crate for `thiserror_impl`
   --> /home/larkins/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thiserror-1.0.59/src/lib.rs:248:9
    |
248 | pub use thiserror_impl::*;
    |         ^^^^^^^^^^^^^^ can't find crate

For more information about this error, try `rustc --explain E0463`.
error: could not compile `thiserror` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `tree-sitter-cli v0.22.6`, intermediate artifacts can be found at `/tmp/cargo-installPOUNjD`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
cargo --version
cargo 1.78.0 (54d8815d0 2024-03-26)
rm -fr ~/.cargo/registry
rustup run  nightly-x86_64-unknown-linux-gnu cargo install tree-sitter-cli
error[E0463]: can't find crate for `thiserror_impl`
   --> /home/larkins/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thiserror-1.0.59/src/lib.rs:248:9
    |
248 | pub use thiserror_impl::*;
    |         ^^^^^^^^^^^^^^ can't find crate

For more information about this error, try `rustc --explain E0463`.
error: could not compile `thiserror` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `tree-sitter-cli v0.22.6`, intermediate artifacts can be found at `/tmp/cargo-installlVsZn4`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

I updated to cargo 1.78.0 and wasn't able to replicate the issue:

image

I found a similar looking issue in cargo's repo, but with llvm_sys instead of thiserror_impl. A comment on the issue indicates that reinstalling Ubuntu and rust (and rebuilding llvm) somehow fixed the problem, although that seems fairly extreme. The maintainers may have a better idea of what could be causing this, but I don't see how this could be on tree-sitter's end. Maybe it's worth filing an issue upstream?