How do I resolve the anchor build error: Failed to obtain package metadata
How do I resolve the anchor build error: Failed to obtain package metadata
Loading saved threads...
DreadedHippy · External communityPost link
External question — Solana Stack Exchange
Author: DreadedHippy
Original post: https://solana.stackexchange.com/questions/12545
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I created a project with the command:
anchor init solanasc
and I receive this error when I run
anchor build
ERROR cargo_build_sbf] Failed to obtain package metadata: `cargo metadata` exited with an error: error: failed to load manifest for workspace member `\\?\C:\Users\user\Desktop\Projects\Rust_projects\solanasc\programs\*`
Caused by:
failed to read `\\?\C:\Users\user\Desktop\Projects\Rust_projects\solanasc\programs\*\Cargo.toml`
Caused by:
The filename, directory name, or volume label syntax is incorrect. (os error 123)
I have tried the solutions
here
:
`anchor build` fails with error, "failed to load manifest for workspace member"
, to no avail.
I am currently using Windows 10, and git bash. Here is my cargo.toml:
[package]
name = "solanasc"
version = "0.1.0"
description = "Created with Anchor"
edition = "2021"
[lib]
crate-type = ["cdylib", "lib"]
name = "solanasc"
[features]
no-entrypoint = []
no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
default = []
[dependencies]
anchor-lang = "0.29.0"
Quote
Report
Fulum · External communityPost link
External answer — Solana Stack Exchange
Author: Fulum
Original post: https://solana.stackexchange.com/a/14708
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I had the same problem, the error suggests that there is an invalid file path or character in the Cargo.toml file.
I resolve it in changing:
[workspace]
members = [
"programs/*"
]
[profile.release]
overflow-checks = true
to
[workspace]
members = [
"programs/my_program_name"
]
[profile.release]
overflow-checks = true
t's not exactly the same configuration as your project, but if it helps.
Quote
Report
yeahdixon · External communityPost link
External answer — Solana Stack Exchange
Author: yeahdixon
Original post: https://solana.stackexchange.com/a/21647
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
Check your toml
you might want
[features]
default = []
cpi = ["no-entrypoint"]
no-entrypoint = []
no-idl = []
no-log-ix-name = []
idl-build = [
"anchor-lang/idl-build",
"anchor-spl/idl-build",
]
[dependencies]
anchor-lang = {version = "0.31.0", features = ["init-if-needed"] }
anchor-spl = { version = "0.31.0", features = ["metadata"] }
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External answer — Solana Stack Exchange Author: Fulum Source score (net votes, not local likes): 0 Original post: https://solana.stackexchange.com/a/14708 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I had the same problem, the error suggests that there is an invalid file path or character in the Cargo.toml file. I resolve it in changing: [workspace] members = [ "programs/*" ] [profile.release] overflow-checks = true to [workspace] members = [ "programs/my_program_name" ] [profile.release] overflow-checks = true t's not exactly the same configuration as your project, but if it helps.
Checking account access…