【发布时间】:2021-01-03 23:14:35
【问题描述】:
我在这里遵循基本步骤:file:///Users/leongaban/.rustup/toolchains/stable-x86_64-apple-darwin/share/doc/rust/html/book/ch01-03-hello-货物.html
我检查了我的 cargo 版本,并 cd .. 备份到我的根项目文件夹并运行以下命令来创建一个新项目:
cargo new hello_cargo
它抛出了以下错误:
错误:无法在
/Users/leongaban/projects/rust_projects/hello_cargo创建包hello_cargo
但是,当我运行 ls 时,它确实创建了文件夹?所以我很好奇我以后如何避免这个错误?
rust_projects % cargo new hello_cargo
error: Failed to create package `hello_cargo` at `/Users/leongaban/projects/rust_projects/hello_cargo`
Caused by:
could not find '/Users/leongaban/.git-templates/' to stat: No such file or directory; class=Os (2); code=NotFound (-3)
rust_projects % ls
hello_cargo hello_world
【问题讨论】:
-
默认情况下,cargo 会尝试在项目中创建 Git 存储库。如果您不需要它,只需运行
cargo new --vcs none hello_cargo。 -
当然也可以安装 git。
标签: rust rust-cargo