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

error: when using wasm-pack new, the version of the installed cargo-generate that is being checked is wrong #1457

Open
Knight-wh opened this issue Dec 15, 2024 · 1 comment

Comments

@Knight-wh
Copy link

🐛 Bug description

The cargo-generate version prints with a space between "cargo" and "generate". So the result of this get_cli_version function is ”generate“

$ cargo-generate -V
cargo generate 0.22.0

code in src/install/mod.rs

/// Fetches the version of a CLI tool
pub fn get_cli_version(tool: &Tool, path: &Path) -> Result<String> {
    let mut cmd = Command::new(path);
    cmd.arg("--version");
    let stdout = child::run_capture_stdout(cmd, tool)?;
    let version = stdout.trim().split_whitespace().nth(1);
    match version {
        Some(v) => Ok(v.to_string()),
        None => bail!("Something went wrong! We couldn't determine your version of the wasm-bindgen CLI. We were supposed to set that up for you, so it's likely not your fault! You should file an issue: https://github.com/rustwasm/wasm-pack/issues/new?template=bug_report.md.")
    }
}

🤔 Expected Behavior

👟 Steps to reproduce

$ RUST_LOG=info wasm-pack new myproject --template  https://github.com/rustwasm/wasm-pack-template
[INFO  wasm_pack::install] Checking installed `cargo-generate` version == expected version: generate == 0.22.0
[INFO]: ⬇️  Installing cargo-generate...

🌍 Your environment

Include the relevant details of your environment.
wasm-pack version: 0.13.1
rustc version: 1.81.0

@Knight-wh
Copy link
Author

#1433 could be the same problem

@Knight-wh Knight-wh changed the title When using wasm-pack new, the version of the installed cargo-generate that is being checked has an error error: when using wasm-pack new, the version of the installed cargo-generate that is being checked is wrong Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant