実現したいこと
Rails4系のアプリを6系にアップデートしようとしています。
4系ではtherubyracerを使っていたのですが、アプデもされておらずrailsから切り離されたとのことで、mini_raceerを使いたいです。
bundle installしてrails sすると以下エラーが出るので解消したいです。
[WARNING] Please install gem 'therubyracer' to use Less. <internal:/Users/oshita/.rbenv/versions/3.1.3/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require': cannot load such file -- v8 (LoadError) from <internal:/Users/oshita/.rbenv/versions/3.1.3/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require' from /Users/oshita/pros/bbs/vendor/bundle/ruby/3.1.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:332:in `block in require' from /Users/oshita/pros/bbs/vendor/bundle/ruby/3.1.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:299:in `load_dependency' from /Users/oshita/pros/bbs/vendor/bundle/ruby/3.1.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:332:in `require' from /Users/oshita/pros/bbs/vendor/bundle/ruby/3.1.0/gems/less-2.6.0/lib/less/java_script/v8_context.rb:2:in `<top (required)>' from <internal:/Users/oshita/.rbenv/versions/3.1.3/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require' from <internal:/Users/oshita/.rbenv/versions/3.1.3/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require' from /Users/oshita/pros/bbs/vendor/bundle/ruby/3.1.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:332:in `block in require' from /Users/oshita/pros/bbs/vendor/bundle/ruby/3.1.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:299:in `load_dependency' from /Users/oshita/pros/bbs/vendor/bundle/ruby/3.1.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:332:in `require' from /Users/oshita/pros/bbs/vendor/bundle/ruby/3.1.0/gems/less-2.6.0/lib/less/java_script.rb:9:in `default_context_wrapper' from /Users/oshita/pros/bbs/vendor/bundle/ruby/3.1.0/gems/less-2.6.0/lib/less/java_script.rb:17:in `context_wrapper' from /Users/oshita/pros/bbs/vendor/bundle/ruby/3.1.0/gems/less-2.6.0/lib/less/loader.rb:13:in `initialize' from /Users/oshita/pros/bbs/vendor/bundle/ruby/3.1.0/gems/less-2.6.0/lib/less.rb:14:in `new' from /Users/oshita/pros/bbs/vendor/bundle/ruby/3.1.0/gems/less-2.6.0/lib/less.rb:14:in `<module:Less>' from /Users/oshita/pros/bbs/vendor/bundle/ruby/3.1.0/gems/less-2.6.0/lib/less.rb:9:in `<top (required)>' from
警告にはtherubyracerをインストールするようにと出ているのですが、どう対処すればよいでしょうか。
また、当方m1チップのmacを使っているのですが、この問題となにか関係あるでしょうか。
一応Gemfileの中身も記載しておきます。
source 'https://rubygems.org' ruby "3.1.3" # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '6.1.7' # Use mysql as the database for Active Record gem 'mysql2', '~> 0.4.10' # Use SCSS for stylesheets gem 'sass-rails' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use CoffeeScript for .coffee assets and views gem 'coffee-rails' # See https://github.com/rails/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby # Use jquery as the JavaScript library gem 'jquery-rails' # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks gem 'turbolinks' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.0' # bundle exec rake doc:rails generates the API under doc/api. gem 'sdoc', '~> 0.4.0', group: :doc # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' # Use Unicorn as the app server # gem 'unicorn' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug' end group :development do # Access an IRB console on exception pages or by using <%= console %> in views gem 'web-console', '~> 2.0' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' end gem 'kaminari' gem 'pry-rails' # gem 'compass-rails','~> 2.0' gem 'sprockets', '>= 2.11.0' gem 'whenever', require: false group :production, :staging do gem 'rails_12factor' end gem 'twitter' # gem 'therubyracer' # javascript runtime。lessをコンパイルするために必要 gem 'mini_racer' gem 'less-rails' # Railsでlessを使えるようにする。Bootstrapがlessで書かれているため gem 'twitter-bootstrap-rails' # Bootstrapの本体 gem "ransack" gem 'mechanize' gem 'rake'
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。