Hi there, author here.
When I wrote the book, Node’s current LTS was v12. Shortly after publication, Node went to LTS 14, and that broke the node pg
package’s current version.
So, that leaves you with a couple of options. If you run Node v12, which is what the package.json specifies, everything should run fine with the code as-is. I would find this solution rather unsatisfying, but if it works for your purposes, go for it!
Otherwise, if you’re on 13.x+, then you’ll need to update to the latest version of the pg
package. That should get it going.