So, there are some versioning issues here. My plan has been to wait until the book goes final to lock the versions in the source code – it makes it easier for me to keep up while the book is in progress.
There are issues with Webpacker 5.1 and the Stimulus controllers (see https://github.com/stimulusjs/stimulus/issues/303), and I haven’t incorporated that fix into the book yet, so I’d try fixing Webpacker to ~5.0 and see if that helps.