与项目相关的任何货物命令都会因货物而失败:
error: failed to load manifest for workspace member `/home/celestial/Documents/projects/graphs`
Caused by:
failed to read `/home/celestial/Documents/projects/graphs/Cargo.toml`
Caused by:
No such file or directory (os error 2)
我正在制作一个简单的脚本,用 Rust 为我创建一个样板项目(代码如下)
#!/bin/bash
if [ ! -n "$1" ]; then
echo "use $(basename "$0") <project-name> instead!"
exit
fi
BASE="$(eval echo ~)/Documents/projects"
NEW_PROJECT="$BASE/$1"
mkdir -p $NEW_PROJECT
cd $NEW_PROJECT
cargo init
xdg-open $NEW_PROJECT
if which bacon; then
echo "bacon found! running..."
(cd $NEW_PROJECT && bacon)
fi
在调试时运行几次后,开始出现此错误
[source.crates-io] registry = "https://github.com/rust-lang/crates.io-index"
添加到我的 ~/.cargo/config 中(在另一个答案中看到)原来我的 ~ 文件夹中有一个 Cargo.toml,所以只需检查任何父目录中是否有 Cargo.toml!