Open5
現場Railsを出版6年後にやってみる
$ rails _5.2.1_ new taskleaf -d postgresql
したら
.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/gems/psych-5.2.3/lib/psych.rb:370:in `load': wrong number of arguments (given 2, expected 1) (ArgumentError)
で怒られた。 rubyは 3.3.5
$ ruby -v
=> ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [arm64-darwin23]
これが関連していそう?
Ruby 2.5.1 って書いてあったのでそのバージョンを入れたいが、ビルドエラー
(macOS 14.4.1 on arm64 using ruby-build 20250130)
M1 Mac だからか?ログ見てねって書いてあるのでログを見る
closure.c:264:14: error: call to undeclared function 'ffi_prep_closure'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
result = ffi_prep_closure(pcl, cif, callback, (void *)self);
このブログに助けられた
$ RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC rbenv install 2.5.1
ERROR: Error installing rails:
The last version of nokogiri (>= 1.6) to support your Ruby & RubyGems was 1.12.5. Try installing it with `gem install nokogiri -v 1.12.5` and then running the current command again
nokogiri requires Ruby version >= 3.1.0. The current ruby version is 2.5.0.
Oh...
html2slim が bundle insall
でコケる
🍣 taskleaf bundle [ 25-03-15 19:20 ]
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Installing hpricot 0.8.6 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
…中略…
An error occurred while installing hpricot (0.8.6), and Bundler cannot continue.
In Gemfile:
html2slim was resolved to 0.2.0, which depends on
hpricot
https://zenn.dev/yksn/articles/aff65f3afb73d0 を参考にさせていただき、最新の html2slim を使うように
bootstrapを追加したところ次のエラー
🍣 taskleaf bin/rails s [ 25-05-03 15:27 ]
/Users/tsumichan/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:71:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'bootstrap'. (Bundler::GemRequireError)
Gem Load Error is: bootstrap-rubygem requires a Sass engine. Please add dartsass-sprockets, sassc-rails, dartsass-rails or cssbundling-rails to your dependencies.
大人しく言われたやつ全部追加する。
gem 'bootstrap'
gem 'dartsass-sprockets'
gem 'sassc-rails'
gem 'dartsass-rails'
すると TSort::Cyclic
エラーが出るので、sassc-rails だけを残す
gem 'bootstrap'
gem 'sassc-rails'