Issue:
I just recently decided to utilize some of the Solana Templates for the first time and during the anchor build, the compilation fails with errors related to missing methods in proc-macro2 v1.0.95.
It appears to be a dependency resolution issue where the version of proc-macro2 being pulled in (1.0.95) is incompatible with the version expected by Anchor's macros... though im not sure.
Error Messages
error[E0599]: no method named `file` found for reference `&proc_macro::Span`
error[E0599]: no method named `local_file` found for reference `&proc_macro::Span`

Environment
- Anchor version: 0.31.1
- Solana CLI: 2.1.21 (src:8a085eeb; feat:1416569292, client:Agave)
- proc-macro2 version: 1.0.95
- OS: Linux (WSL2)
- Rust version: 1.87.0
More Details
The error occurs in the proc-macro2 crate's wrapper.rs file, specifically when trying to access file() and local_file() methods on proc_macro::Span. These methods appear to be either:
- Not available in the current version
- Behind a feature flag
- Incompatible with the current version of proc-macro2 being used
Steps to Reproduce
- Followed the README.md guide to create a new project:
pnpm create solana-dapp@latest -t gh:solana-developers/solana-templates/templates/template-next-tailwind-basic
- Run
pnpm install
- Run
pnpm run setup
- Run
pnpm run anchor-build
- Observe compilation errors related to proc-macro2
- Is there a specific version of proc-macro2 that is known to work with the current Anchor version?
- Are there any feature flags that need to be enabled/disabled to resolve this issue?
Issue:
I just recently decided to utilize some of the Solana Templates for the first time and during the
anchor build, the compilation fails with errors related to missing methods inproc-macro2v1.0.95.It appears to be a dependency resolution issue where the version of proc-macro2 being pulled in (1.0.95) is incompatible with the version expected by Anchor's macros... though im not sure.
Error Messages
Environment
More Details
The error occurs in the
proc-macro2crate's wrapper.rs file, specifically when trying to accessfile()andlocal_file()methods onproc_macro::Span. These methods appear to be either:Steps to Reproduce
pnpm create solana-dapp@latest -t gh:solana-developers/solana-templates/templates/template-next-tailwind-basicpnpm installpnpm run setuppnpm run anchor-build