After i install rust and cargo using
brew install rustup
rustup-init , and try to build a new project, An error threw:
And if i use
sudo cargo build , it fix.
But at some situation i have to use just
cargo build , how can i solve the problem?
OS: mac OS Monterey 12.0.1 Apple M1
cargo version : cargo 1.58.0 (f01b232bc 2022-01-19)
It fails because you must have used
sudo cargo build first, which made the lock file belong to the root user. What you need to do is to copy your code somewhere else (which I think is just one file),
sudo rm -r HelloWorld, then make a new project, copy back the code, and never again use
sudo for any
Thank you very much. I think I would still be in trouble without your help
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.