The source ... requires a lock file to be present first before it can be used against vendored source code

I tried to vendor a dependency with git & rev, but running the following command

cargo vendor > .cargo/config.toml
cargo build --release --offline
cargo install --path . --verbose

give the error:

error: failed to compile `test-cargo-vendor-rev v0.1.0 (/Users/cjw/dev_tmp/test-cargo-vendor-rev)`, intermediate artifacts can be found at `/Users/cjw/dev_tmp/test-cargo-vendor-rev/target`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Caused by:
  failed to get `sqlparser` as a dependency of package `test-cargo-vendor-rev v0.1.0 (/Users/cjw/dev_tmp/test-cargo-vendor-rev)`

Caused by:
  failed to load source for dependency `sqlparser`

Caused by:
  Unable to update https://github.com/byte-sourcerer/datafusion-sqlparser-rs?rev=1cd4f7c

Caused by:
  the source git+https://github.com/byte-sourcerer/datafusion-sqlparser-rs?rev=1cd4f7c requires a lock file to be present first before it can be
  used against vendored source code

  remove the source replacement configuration, generate a lock file, and then
  restore the source replacement configuration to continue the build

the minimal reproduction code.

Version of cargo:

cargo --version
cargo 1.83.0 (5ffbef321 2024-10-29)

I solved thiss problem by run:

cargo install --path . --verbose --locked

instead of:

cargo install --path . --verbose