extrawurst / gitui

Blazing 💥 fast terminal-ui for git written in rust 🦀
MIT License
18.53k stars 570 forks source link

cargo install fails due to ratatui-version missmatch #2346

Open NilsWer opened 2 months ago

NilsWer commented 2 months ago

Describe the bug

cargo install gitui fails. ratatui version seems to be outdated at https://crates.io/crates/gitui/0.26.3/dependencies (^0.26) compared to Cargo.toml in git-repo (0.27) (https://github.com/extrawurst/gitui/commit/95bbbda9af9a31830b32f491a8308e667c017f94)

Compiling the git-repo works fine.

Reproduce

does not work

  1. cargo install gitui

works

  1. git clone [...] temp_dir
  2. cd temp_dir
  3. cargo run

Context (please complete the following information)

Additional context

Whole error:

[...] Compiling syntect v5.2.0 Compiling ratatui v0.26.3 Compiling crossterm v0.28.1 Compiling which v6.0.3 Compiling two-face v0.4.0 Compiling ratatui v0.28.1 Compiling tui-textarea v0.4.0 Compiling git2 v0.18.3 Compiling git2-hooks v0.3.3 Compiling asyncgit v0.26.3 error[E0308]: mismatched types --> /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gitui-0.26.3/src/components/textinput.rs:157:28 157 .set_cursor_line_style(self.theme.text(true, false)); --------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected ratatui::style::Style, found a differ
arguments to this method are incorrect
 = note: `ratatui::style::Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: ratatui::style::Style is defined in crate ratatui --> /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.26.3/src/style.rs:227:1 227 pub struct Style { ^^^^^^^^^^^^^^^^ note: ratatui::style::Style is defined in crate ratatui --> /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.28.1/src/style.rs:228:1
228 pub struct Style {
^^^^^^^^^^^^^^^^
 = note: perhaps two different versions of crate `ratatui` are being used?

note: method defined here --> /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-textarea-0.4.0/src/textarea.rs:1770:12 | 1770 | pub fn set_cursor_line_style(&mut self, style: Style) { | ^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types --> /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gitui-0.26.3/src/components/textinput.rs:160:5 159 text_area.set_placeholder_style( --------------------- arguments to this method are incorrect 160 / self.theme 161 .text(self.selected.unwrap_or_default(), false), ___^ expected ratatui::style::Style, found a diff
 = note: `ratatui::style::Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: ratatui::style::Style is defined in crate ratatui --> /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.26.3/src/style.rs:227:1 227 pub struct Style { ^^^^^^^^^^^^^^^^ note: ratatui::style::Style is defined in crate ratatui --> /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.28.1/src/style.rs:228:1
228 pub struct Style {
^^^^^^^^^^^^^^^^
 = note: perhaps two different versions of crate `ratatui` are being used?

note: method defined here --> /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-textarea-0.4.0/src/textarea.rs:1850:12 | 1850 | pub fn set_placeholder_style(&mut self, style: Style) { | ^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types --> /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gitui-0.26.3/src/components/textinput.rs:164:5 163 text_area.set_style( --------- arguments to this method are incorrect 164 self.theme.text(self.selected.unwrap_or(true), false), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected ratatui::style::Style, found a diff
 = note: `ratatui::style::Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: ratatui::style::Style is defined in crate ratatui --> /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.26.3/src/style.rs:227:1 227 pub struct Style { ^^^^^^^^^^^^^^^^ note: ratatui::style::Style is defined in crate ratatui --> /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.28.1/src/style.rs:228:1
228 pub struct Style {
^^^^^^^^^^^^^^^^
 = note: perhaps two different versions of crate `ratatui` are being used?

note: method defined here --> /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-textarea-0.4.0/src/textarea.rs:1629:12 | 1629 | pub fn set_style(&mut self, style: Style) { | ^^^^^^^^^

error[E0308]: mismatched types --> /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gitui-0.26.3/src/components/textinput.rs:169:6 168 text_area.set_block( --------- arguments to this method are incorrect 169 / Block::default() 170 .borders(Borders::ALL) 171 .border_style( 172 ratatui::style::Style::default() ... 176 ) 177 .title(self.title.clone()), __^ expected Block<'_>, found ratatui::widgets::Block<'_>
 = note: `ratatui::widgets::Block<'_>` and `Block<'_>` have similar names, but are actually distinct types
note: ratatui::widgets::Block<'_> is defined in crate ratatui --> /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.26.3/src/widgets/block.rs:64:1 64 pub struct Block<'a> { ^^^^^^^^^^^^^^^^^^^^ note: Block<'_> is defined in crate ratatui --> /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.28.1/src/widgets/block.rs:109:1
109 pub struct Block<'a> {
^^^^^^^^^^^^^^^^^^^^
 = note: perhaps two different versions of crate `ratatui` are being used?

note: method defined here --> /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-textarea-0.4.0/src/textarea.rs:1648:12 | 1648 | pub fn set_block(&mut self, block: Block<'a>) { | ^^^^^^^^^

error[E0277]: the trait bound impl ratatui::widgets::Widget + '_: Widget is not satisfied --> /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gitui-0.26.3/src/components/textinput.rs:644:20 644 f.render_widget(ta.widget(), area); ------------- ^^^^^^^^^^^ the trait Widget is not implemented for impl ratatui::widgets::Widget + '_
required by a bound introduced by this call
= help: the following other types implement trait `Widget`:
          &W
          &str
          BarChart<'_>
          Canvas<'_, F>
          Chart<'_>
          Gauge<'_>
          LineGauge<'_>
          Paragraph<'_>
        and 10 others

note: required by a bound in ratatui::Frame::<'_>::render_widget --> /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.26.3/src/terminal/frame.rs:74:29 | 74 | pub fn renderwidget(&mut self, widget: W, area: Rect) { | ^^^^^^ required by this bound in `Frame::<'>::render_widget`

Some errors have detailed explanations: E0277, E0308. For more information about an error, try rustc --explain E0277. The following warnings were emitted during compilation:

warning: gitui@0.26.3: buildname 'nightly 2024-08-28 (17ca14e)'

error: could not compile gitui (bin "gitui") due to 5 previous errors error: failed to compile gitui v0.26.3, intermediate artifacts can be found at /tmp/cargo-installfSFcy2. To reuse those artifacts with a future compilation, set the environment variable CARGO_TARGET_DIR to that path.

apraga commented 1 month ago

cargo install gitui --locked worked for me.

NilsWer commented 1 month ago

this works for me too, using ratatui v0.26.3

I read a little in the book and --locked does not look like a good permanent solution to me.

The downside to using --locked is that you will not receive any fixes or updates to any dependency. Note that Cargo did not start publishing Cargo.lock files until version 1.37, which means packages published with prior versions will not have a Cargo.lock file available. https://doc.rust-lang.org/cargo/commands/cargo-install.html