Cargo publish error

in core folder

[package]
name = "prime"
version = "0.1.0"
edition = "2024"

[dependencies]
flate2 = "1.1.0"
http-scrap = "0.1.1134"
quote = "1.0.38"
rusty-format = "0.1.4"
serde = "1.0.218"
serde_json = "1.0.139"
syn = { version = "2.0.98", features = ["full", "extra-traits"] }
gate = { path = "../main", version = "0.1.0" }
pub use gate::gates;

in root

[workspace]
members = ["core", "main"]
error[E0432]: unresolved import `gate::gates`
  --> src\lib.rs:14:9
   |
14 | pub use gate::gates;
   |         ^^^^^^^^^^^ no `gates` in the root

Are you trying to publish to crates.io? When publishing on crates.io, your dependency will be resolved to the version location from the default registry, not to the path location, which is only used locally. There already exist a package called gate on crates.io and v0.1.0 of it does not have a gates module.

then how can i solve this issue using local file to another

I don't understand what you are referring to here. You can resolve the issue by renaming your gate package to something that is not already taken and publish it before publishing prime.

i need to use the main lib inside core lib and publish
i need to keep the main lib not as published lib
i need to use it as helper function
i changed name to somthing not exist
but not working

error: failed to prepare local package for uploading
Caused by:
  no matching package named `corelib` found
  location searched: crates.io index
corelib = { path = "../main", version = "0.1.0" }
name = "corelib"
version = "0.1.0"
edition = "2024"

You can't publish crates to crates.io that depend on other crates that aren't also published to crates.io. You have to change the structure of your project or publish your main lib. From the docs I linked above:

crates.io does not allow packages to be published with dependencies on code outside of crates.io, except for dev-dependencies. See the Multiple locations section for a fallback alternative for git and path dependencies.

1 Like

structure


not working without publishing
any best way

I didn't mean you should change the file structure, but that you need to get rid of the corelib dependency completely (integrating it into prime) or publish it. There is no other way, you can't publish a crate on crates.io that depends on crates that aren't published there as well. So either publish your depenency or remove it from the [dependencies] section of your manifest file.

3 Likes

then how crate like framework use macro file inside non macro file without publishing procmacro file in cargo

Like serde-macros? They publish the "utils" crates on crates.io first.

1 Like

thanks