registry icon indicating copy to clipboard operation
registry copied to clipboard

error: could not find `Cargo.toml`

Open fbaube opened this issue 1 year ago • 3 comments

Apologies, as this is a n00b question. (My language of choice is Go, not Rust.)

Re. README.md / Getting Started / Running the server:

When I try the command

cargo run -p warg-server -- --content-dir content

I get the error message

error: could not find Cargo.toml in /Users/fbaube/[the execution directory] or any parent directory

What is the correct way to remove this message ?

fbaube avatar Nov 24 '24 11:11 fbaube

Ah, I believe those instructions assume that this repo is cloned locally and you're running that command from that directory. Might be your issue

calvinrp avatar Nov 24 '24 21:11 calvinrp

Aha. I neglected to add that I installed warg-cli and warg-server by using cargo at the command line. But shouldn't they be configured so that they can run standalone and not require a Cargo.toml ? This certainly seems like a bug.

In any case, I might have solved this (as a workaround):

  1. The command cargo build ran successfully, giving me an executable ./target/debug/warg
  2. I inserted the directory ./target/debug/at the head of my PATH
  3. Then this command (from README.md) succeeded: cargo run -p warg-server -- --content-dir content

fbaube avatar Nov 25 '24 08:11 fbaube

Cargo.toml is similar to go.mod, it is for build time dependencies. cargo run and cargo build both will be building the project and looking for the Cargo.toml in the workspace directory. Similar to go run and go build.

cargo install warg-server will build and install the binary. Similar to go install. Then you can use those installed binaries in your PATH.

calvinrp avatar Nov 25 '24 12:11 calvinrp