Josh

Josh

Modern Front-End Development for Rails, Second Edition: can't get code to run

I just bought this book today and am having trouble getting the sample code running on an M1 MacBook.

I cd into chapter_01/02 do git init to save the initial state. Then I install Ruby 3.1.2 and run bundle install.

An error occurred while installing html_tokenizer (0.0.7), and Bundler cannot continue.

In Gemfile:
  erb_lint was resolved to 0.1.1, which depends on
    better_html was resolved to 1.0.16, which depends on
      html_tokenizer
$ ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin24]

Here’s the error log:

current directory: /Users/username/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/html_tokenizer-0.0.7/ext/html_tokenizer_ext
/Users/username/.rbenv/versions/3.1.2/bin/ruby -I /Users/username/.rbenv/versions/3.1.2/lib/ruby/3.1.0 -r ./siteconf20250429-32568-hbwjju.rb extconf.rb
creating Makefile

current directory: /Users/username/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/html_tokenizer-0.0.7/ext/html_tokenizer_ext
make DESTDIR\= clean

current directory: /Users/username/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/html_tokenizer-0.0.7/ext/html_tokenizer_ext
make DESTDIR\=
compiling html_tokenizer.c
compiling parser.c
parser.c:459:45: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
  459 |       INT2NUM(ref.line_number), INT2NUM(ref.column_number));
      |                                 ~~~~~~~ ~~~~^~~~~~~~~~~~~
parser.c:459:19: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
  459 |       INT2NUM(ref.line_number), INT2NUM(ref.column_number));
      |       ~~~~~~~ ~~~~^~~~~~~~~~~
parser.c:458:51: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
  458 |       INT2NUM(ref.mb_start), INT2NUM(ref.mb_start + mb_strlen),
      |                              ~~~~~~~ ~~~~~~~~~~~~~^~~~~~~~~~~
parser.c:458:19: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
  458 |       INT2NUM(ref.mb_start), INT2NUM(ref.mb_start + mb_strlen),
      |       ~~~~~~~ ~~~~^~~~~~~~
parser.c:498:9: warning: unused variable 'old' [-Wunused-variable]
  498 |   void *old = parser->doc.data;
      |         ^~~
parser.c:721:26: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
  721 |   return INT2NUM(parser->errors_count);
      |          ~~~~~~~ ~~~~~~~~^~~~~~~~~~~~
parser.c:792:3: error: incompatible function pointer types passing 'VALUE (VALUE, VALUE)' (aka 'unsigned long (unsigned long, unsigned long)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-function-pointer-types]
  792 |   rb_define_method(cParser, "errors", parser_errors_method, 0);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/username/.rbenv/versions/3.1.2/include/ruby-3.1.0/ruby/internal/anyargs.h:287:135: note: expanded from macro 'rb_define_method'
  287 | #define rb_define_method(klass, mid, func, arity)           RBIMPL_ANYARGS_DISPATCH_rb_define_method((arity), (func))((klass), (mid), (func), (arity))
      |                                                                                                                                       ^~~~~~
/Users/username/.rbenv/versions/3.1.2/include/ruby-3.1.0/ruby/internal/anyargs.h:276:1: note: passing argument to parameter here
  276 | RBIMPL_ANYARGS_DECL(rb_define_method, VALUE, const char *)
      | ^
/Users/username/.rbenv/versions/3.1.2/include/ruby-3.1.0/ruby/internal/anyargs.h:254:72: note: expanded from macro 'RBIMPL_ANYARGS_DECL'
  254 | RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _00(__VA_ARGS__, VALUE(*)(VALUE), int); \
      |                                                                        ^
6 warnings and 1 error generated.
make: *** [parser.o] Error 1

make failed, exit code 2

I spent almost an hour with Copilot trying to debug it, but still couldn’t get it to run. I updated some of the dependencies, but that just created other errors where it couldn’t find the Logger.

Has anyone been able to get the sample code working recently?

Popular Prag Prog topics Top

belgoros
Following the steps described in Chapter 6 of the book, I’m stuck with running the migration as described on page 84: bundle exec sequel...
New
sdmoralesma
Title: Web Development with Clojure, Third Edition - migrations/create not working: p159 When I execute the command: user=> (create-...
New
mikecargal
Title: Hands-on Rust: question about get_component (page 295) (feel free to respond. “You dug you’re own hole… good luck”) I have somet...
New
HarryDeveloper
Hi @venkats, It has been mentioned in the description of ‘Supervisory Job’ title that 2 things as mentioned below result in the same eff...
New
New
curtosis
Running mix deps.get in the sensor_hub directory fails with the following error: ** (Mix) No SSH public keys found in ~/.ssh. An ssh aut...
New
jskubick
I found an issue in Chapter 7 regarding android:backgroundTint vs app:backgroundTint. How to replicate: load chapter-7 from zipfile i...
New
New
AufHe
I’m a newbie to Rails 7 and have hit an issue with the bin/Dev script mentioned on pages 112-113. Iteration A1 - Seeing the list of prod...
New
Keton
When running the program in chapter 8, “Implementing Combat”, the printout Health before attack was never printed so I assumed something ...
New

Other popular topics Top

Exadra37
Please tell us what is your preferred monitor setup for programming(not gaming) and why you have chosen it. Does your monitor have eye p...
New
Rainer
My first contact with Erlang was about 2 years ago when I used RabbitMQ, which is written in Erlang, for my job. This made me curious and...
New
AstonJ
We have a thread about the keyboards we have, but what about nice keyboards we come across that we want? If you have seen any that look n...
New
Exadra37
On modern versions of macOS, you simply can’t power on your computer, launch a text editor or eBook reader, and write or read, without a ...
New
AstonJ
Inspired by this post from @Carter, which languages, frameworks or other tech or tools do you think is killing it right now? :upside_down...
New
mafinar
Crystal recently reached version 1. I had been following it for awhile but never got to really learn it. Most languages I picked up out o...
New
mafinar
This is going to be a long an frequently posted thread. While talking to a friend of mine who has taken data structure and algorithm cou...
New
PragmaticBookshelf
Author Spotlight: Sophie DeBenedetto @SophieDeBenedetto The days of the traditional request-response web application are long gone, b...
New
First poster: bot
zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig. General-purpose programming language and toolchain for maintaini...
New
AstonJ
If you’re getting errors like this: psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New

Latest in PragProg

View all threads ❯