使用Stack构建Yesod-SQLite测试项目时遭遇Aeson错误求助
Hey there, fellow Yesod/Stack newcomer! It’s super frustrating when a bug that’s supposed to be fixed still pops up—let’s work through this Aeson error together.
Even though the issue was marked fixed in Aeson 1.6.1, here are some common reasons you might still hit it with 1.6.3, plus fixes to try:
Double-check your project’s resolver
Stack’s resolver dictates which package versions your project uses, even if you have a newer Stack CLI version. Runstack resolverin your project folder to see which resolver you’re on. If it’s an older snapshot that predates the Aeson fix, update theresolverfield in yourstack.yamlto a newer version that includes Aeson 1.6.3+, then runstack setup && stack buildto refresh dependencies.Clear Stack’s cached packages
Stale cached packages can cause weird version mismatches that ignore your intended versions. Try running these commands to wipe the cache and start fresh:stack clean --full stack purgeThen re-run
stack buildto pull down fresh copies of all dependencies, including the fixed Aeson version.Verify the actual Aeson version your project is using
Runstack list-dependencies | grep aesonto see exactly which Aeson version your project is pulling in. If it’s still pre-1.6.1, a dependency in your tree is forcing an older version. Add an explicit constraint to yourpackage.yaml(or.cabalfile) to enforce the fixed version:dependencies: - aeson >= 1.6.3Then run
stack buildagain to resolve the version conflict.Check the Yesod template’s dependency constraints
Some Yesod templates have hardcoded dependency versions that override Stack’s settings. Open the template’spackage.yamlor.cabalfile to see if there’s an explicit Aeson constraint pinning it to an older version. If so, update that line to require Aeson 1.6.1+.
I’ve dealt with these kinds of version mismatch headaches plenty of times—these steps should help you get past the error and back to building your Yesod sites!
内容的提问来源于stack exchange,提问作者jaybee

