无法安装cosmwasm-check:编译报错及后续问题求助
问题:执行
cargo install cosmwasm-check时的TOML解析错误 问题描述
我执行命令:
cargo install cosmwasm-check
出现如下错误:
error: failed to compile `cosmwasm-check v1.2.1`, intermediate artifacts can be found at `/tmp/cargo-installF9zQyx` Caused by: failed to download `addr2line v0.19.0` Caused by: unable to get packages from source Caused by: failed to parse manifest at `/home/xxvxrxx/.cargo/registry/src/github.com-1ecc6299db9ec823/addr2line-0.19.0/Cargo.toml` Caused by: could not parse input as TOML Caused by: TOML parse error at line 1, column 1 | 1 | | ^ Unexpected `` Expected key or end of input
更新:我从GitHub复制了该Toml文件,但现在同一文件夹下的下一个crate出现了相同错误。
原因分析
- 本地Cargo注册表中的
addr2line-0.19.0包对应的Cargo.toml文件损坏(为空或格式完全错误),导致TOML解析失败。 - 单个替换文件无法解决问题,说明本地注册表目录内存在多个损坏的包文件,大概率是之前下载中断、磁盘异常或权限问题,导致注册表缓存的包文件完整性受损。
解决方法
- 清理本地注册表缓存:直接清空crates.io的本地缓存目录,让Cargo重新下载完整的包:
cargo clean rm -rf ~/.cargo/registry/src/github.com-1ecc6299db9ec823/
执行完后重新运行cargo install cosmwasm-check,Cargo会重新从官方源拉取所有需要的包,确保每个包的配置文件都是完整有效的。
- 排查底层问题:如果清理后仍出现同类错误,要检查磁盘是否有坏道,以及
~/.cargo目录的读写权限是否正常,避免后续下载的文件再次损坏。
内容的提问来源于stack exchange,提问作者xx_VxR_xx
相关产品推荐
相关产品推荐

