I am trying to learn Yesod and I started to have a look at https://www.yesodweb.com/book.
Before reading the book, I executed on my WSL2 Ubuntu 20.04 LTS the instructions provided at https://www.yesodweb.com/page/quickstart :
curl -sSL https://get.haskellstack.org/ | sh
stack new yesod-book yesodweb/sqlite && cd yesod-book
stack install yesod-bin --install-ghc # install yesod cli
# updated the $PATH in my .zshrc and reloaded the terminal
stack build
stack test --flag yesod-book:library-only --flag yesod-book:dev
Compilation works with some warnings at /mnt/d/Code/yesod_and_haskell/src/Model.hs:23:1: warning: [-Wname-shadowing]
but this does not prevent the examples to succeed.
However, when I run the development server
stack exec -- yesod devel
# ...
[12 of 12] Compiling Paths_yesod_book
yesod-book> copy/register
Installing library in /mnt/d/Code/yesod_and_haskell/.stack-work/install/x86_64-linux/f0163dccc19ddaa0efa9ec567b016ae57bd5477fab521d675f34f49ffd7923d3/9.2.7/lib/x86_64-linux-ghc-9.2.7/yesod-book-0.0.0-11M4iC3bTuY3cNtaxd5kQS
Registering library for yesod-book-0.0.0..
Success! Waiting for next file change.
Type help for available commands. Press enter to force a rebuild.
When I connect to http://localhost:3000 I keep seeing
I tried to clear all the hidden folders containing build artifacts and rebuilding the project from scratch but this did not help.
stack --version
Version 2.9.1, Git revision 409d56031b4240221d656db09b2ba476fe6bb5b1 x86_64 hpack-0.35.0
yesod version
yesod-bin version: 1.6.2.2
ghci version
GHCi, version 9.2.5
I am looking at past issues on github, but I am not sure about how to make them actionable for my problem:
The full configuration of my sample project can be found at this repo
How can I run my default application in devel mode?
2
Answers
Following @schoettl comment and yesodweb/yesod/issues#1755, I tried to run the application from gchi instead of yesod bin.
This shown the logs described by @sergiu-starciuc comments
And the application worked as expected.
Try cleaning before building and running:
yesod-book$ stack clean && stack build && stack exec -- yesod devel
Also make sure you have the required System libraries installed.