`cargo sqlx prepare` does not work despite being recommended by sqlx error message
I forgot to set DATABASE_URL and I'm getting a bunch of errors:
error: set `DATABASE_URL` to use query macros online, or run `cargo sqlx prepare` to update the query cache
but this is misleading since cargo sqlx prepare doesn't actually work, at least not on my system:
❯ cargo sqlx prepare
error: no such command: `sqlx`
Did you mean `fix`?
View all installed commands with `cargo --list`
Try cargo install sqlx-cli.
Apologies for the confusion: The issue I'm raising is that the first error message should include cargo install sqlx-cli.
I agree with @samuela , the error message is supposed to solve the problem for users, but it doesn't, because it misses one piece of information.
Please consider adding a text like To run cargo sqlx prepare, please install sqlx-cli first by running cargo install sqlx-cli.
I am in the same situation as you but after i run cargo install sqlx-cli, then i run cargo sqlx prepare and my terminal threw an error warning: virtual workspace defaulting to resolver = "1"despite one or more workspace members being on edition 2021 which impliesresolver = "2"note: to keep the current resolver, specifyworkspace.resolver = "1"in the workspace root's manifest note: to use the edition 2021 resolver, specifyworkspace.resolver = "2" in the workspace root's manifest note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.h tml#resolver-versions
If you did solve your situation successful. Can you help me plz ...
I agree with @samuela , the error message is supposed to solve the problem for users, but it doesn't, because it misses one piece of information. Please consider adding a text like
To run cargo sqlx prepare, please install sqlx-cli first by running cargo install sqlx-cli.
Yep, I also just ran into this issue while trying out a simple todo-mvc demo to learn about sqlx and it was definitely a minor pain that could be fixed with a more precise error message.
It's not a huge time kill, but just having to pop a search engine for this issue to figure out how to get 'cargo sqlx prepare' to work when it doesn't come out of the box by default (and the command to install it unfortunately isn't the MOST obvious answer of 'cargo install sqlx', but instead 'cargo install sqlx-cli') would be great to avoid.
Easy on-boarding is important! Thank you for the slick lib. <3