桐山 です
# 久し振り(おそらく数年以上)に投稿します.
Rails をやろうと環境を整えているんですが,アクションからテン
プレートを呼び出したところで「webpack が無い」と言われ,
package.json に scripts として webpack を登録すると webpack
が無限に繰り返されます:
kiri@smtp:~/work/rails/books[1050]% rails server -u webrick
=> Booting WEBrick
=> Rails 6.1.7.6 application starting in development http://localhost:3000
=> Run `bin/rails server --help` for more startup options
[2024-02-19 09:44:44] INFO WEBrick 1.8.1
[2024-02-19 09:44:44] INFO ruby 3.3.0 (2023-09-14) [amd64-freebsd15]
[2024-02-19 09:44:44] INFO WEBrick::HTTPServer#start: pid=2611 port=3000
Started GET "/hello" for 192.168.1.1 at 2024-02-19 09:44:49 +0900
Cannot render console from 192.168.1.1! Allowed networks: 127.0.0.0/127.255.255.255, ::1
(0.6ms) SELECT sqlite_version(*)
Processing by BooklistController#hello as HTML
Rendering layout layouts/application.html.erb
Rendering booklist/hello.html.erb within layouts/application
Rendered booklist/hello.html.erb within layouts/application (Duration: 0.7ms | Allocations: 318)
[Webpacker] Compiling...
^C[2024-02-19 09:44:52] INFO going to shutdown ...
[Webpacker] Compilation failed:
yarn run v1.22.19
$ ./bin/webpack --config /home/kiri/work/rails/books/config/webpack/development.js
$ ./bin/webpack --config /home/kiri/work/rails/books/config/webpack/development.js --config /home/kiri/work/rails/books/config/webpack/development.js
$ ./bin/webpack --config /home/kiri/work/rails/books/config/webpack/development.js --config /home/kiri/work/rails/books/config/webpack/development.js --config /home/kiri/work/rails/books/config/webpack/development.js
<internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require': Interrupt
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from /usr/local/lib/ruby/gems/3.3/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/synchronization/safe_initialization.rb:1:in `<top (required)>'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from /usr/local/lib/ruby/gems/3.3/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/synchronization/object.rb:3:in `<top (required)>'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from /usr/local/lib/ruby/gems/3.3/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/synchronization/abstract_lockable_object.rb:3:in `<top (required)>'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from /usr/local/lib/ruby/gems/3.3/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/synchronization/lockable_object.rb:2:in `<top (required)>'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from /usr/local/lib/ruby/gems/3.3/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/event.rb:2:in `<top (required)>'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from /usr/local/lib/ruby/gems/3.3/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/concern/obligation.rb:4:in `<top (required)>'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from /usr/local/lib/ruby/gems/3.3/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/delay.rb:2:in `<top (required)>'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from /usr/local/lib/ruby/gems/3.3/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/configuration.rb:2:in `<top (required)>'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from /usr/local/lib/ruby/gems/3.3/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent.rb:4:in `<top (required)>'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from /usr/local/lib/ruby/gems/3.3/gems/activesupport-6.1.7.6/lib/active_support/logger_thread_safe_level.rb:5:in `<top (required)>'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from /usr/local/lib/ruby/gems/3.3/gems/activesupport-6.1.7.6/lib/active_support/logger_silence.rb:5:in `<top (required)>'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from /usr/local/lib/ruby/gems/3.3/gems/activesupport-6.1.7.6/lib/active_support/logger.rb:3:in `<top (required)>'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from /usr/local/lib/ruby/gems/3.3/gems/webpacker-5.4.4/lib/webpacker.rb:3:in `<top (required)>'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from <internal:/usr/local/lib/ruby/site_ruby/3.3/rubygems/core_ext/kernel_require.rb>:38:in `require'
from ./bin/webpack:12:in `<main>'
Rendered layout layouts/application.html.erb (Duration: 3286.9ms | Allocations: 279247)
Completed 500 Internal Server Error in 3305ms (ActiveRecord: 0.0ms | Allocations: 282157)
ActionView::Template::Error (Webpacker can't find application.js in /home/kiri/work/rails/books/public/packs/manifest.json. Possible causes:
1. You want to set webpacker.yml value of compile to true for your environment
unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.
Your manifest contains:
{
}
):
7: <%= csp_meta_tag %>
8:
9: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
10: <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
11: </head>
12:
13: <body>
app/views/layouts/application.html.erb:10
app/controllers/booklist_controller.rb:3:in `hello'
192.168.1.1 - - [19/Feb/2024:09:44:49 JST] "GET /hello HTTP/1.1" 500 162149
- -> /hello
[2024-02-19 09:44:53] INFO WEBrick::HTTPServer#start done.
Exiting
kiri@smtp:~/work/rails/books[1051]%
アクションおよびテンプレートは↓のようなかんじです
kiri@smtp:~/work/rails/books[1053]% cat app/controllers/booklist_controller.rb
class BooklistController < ApplicationController
def hello
render "booklist/hello"
end
def bye
render plain: 'bye!'
end
end
kiri@smtp:~/work/rails/books[1054]% cat app/views/booklist/hello.html.erb
<h1>Hello</h1>
<p>
こんにちは。お元気ですか。
</p>
kiri@smtp:~/work/rails/books[1055]%
ファイルシステムは↓の通りです.
kiri@smtp:~/work/rails/books[1055]% find . -type f > ~/tmp/temp.log
./Rakefile
./vendor/.keep
./package.json~
./README.md
./log/development.log
./log/.keep
./public/apple-touch-icon-precomposed.png
./public/robots.txt
./public/422.html
./public/apple-touch-icon.png
./public/favicon.ico
./public/500.html
./public/404.html
./public/index.html
./Gemfile.org
./.gitattributes
./package.json.org
./.gitignore
./tmp/miniprofiler/mp_timers_ye7rub43zoaco27ea649
:
(snip)
:
./tmp/miniprofiler/mp_timers_ssq3jnff108alz0ptrw1
./tmp/restart.txt
./tmp/.keep
./tmp/pids/.keep
./tmp/cache/bootsnap/compile-cache-iseq/4c/cf6da8cd80f20e
:
(snip)
:
./tmp/cache/bootsnap/compile-cache-iseq/c7/890bd96945a71b
./tmp/cache/bootsnap/load-path-cache
./tmp/cache/assets/sprockets/v3.0/w5/w5ce1GDrZBEteLs1_SiFnsYE4Ma2iXyHM5laQNtEihI.cache
:
(snip)
:
./tmp/cache/assets/sprockets/v3.0/Be/Beaa_ysBdn9z0cOMYxr7dM0f7vTzKhaJQMRLAPQN26w.cache
./tmp/cache/webpacker/last-compilation-digest-development
./tmp/storage/.keep
./tmp/development_secret.txt
./Gemfile
./config/credentials.yml.enc
./config/master.key
./config/application.rb
./config/webpack/test.js
./config/webpack/production.js
./config/webpack/environment.js
./config/webpack/development.js
./config/puma.rb
./config/routes.rb
./config/locales/en.yml
./config/boot.rb
./config/environment.rb
./config/routes.rb.org
./config/initializers/assets.rb
./config/initializers/permissions_policy.rb
./config/initializers/inflections.rb
./config/initializers/mime_types.rb
./config/initializers/wrap_parameters.rb
./config/initializers/filter_parameter_logging.rb
./config/initializers/cookies_serializer.rb
./config/initializers/content_security_policy.rb
./config/initializers/backtrace_silencers.rb
./config/initializers/application_controller_renderer.rb
./config/environments/development.rb
./config/environments/test.rb
./config/environments/production.rb
./config/cable.yml
./config/storage.yml
./config/webpacker.yml
./config/database.yml
./config/spring.rb
./Gemfile.lock
./.git/info/exclude
./.git/description
./.git/config
./.git/HEAD
./.git/hooks/pre-applypatch.sample
./.git/hooks/pre-commit.sample
./.git/hooks/applypatch-msg.sample
./.git/hooks/push-to-checkout.sample
./.git/hooks/pre-merge-commit.sample
./.git/hooks/prepare-commit-msg.sample
./.git/hooks/fsmonitor-watchman.sample
./.git/hooks/post-update.sample
./.git/hooks/commit-msg.sample
./.git/hooks/pre-receive.sample
./.git/hooks/pre-rebase.sample
./.git/hooks/sendemail-validate.sample
./.git/hooks/pre-push.sample
./.git/hooks/update.sample
./package.json
./.ruby-version
./test/application_system_test_case.rb
./test/integration/.keep
./test/helpers/.keep
./test/test_helper.rb
./test/system/.keep
./test/models/.keep
./test/controllers/booklist_controller_test.rb
./test/controllers/.keep
./test/channels/application_cable/connection_test.rb
./test/fixtures/files/.keep
./test/mailers/.keep
./db/development.sqlite3
./db/seeds.rb
./lib/assets/.keep
./lib/tasks/.keep
./storage/.keep
./bin/webpack
./bin/setup
./bin/spring
./bin/webpack-dev-server
./bin/rails
./bin/rake
./bin/yarn
./config.ru
./app/mailers/application_mailer.rb
./app/jobs/application_job.rb
./app/assets/config/manifest.js
./app/assets/images/.keep
./app/assets/stylesheets/application.css
./app/assets/stylesheets/booklist.scss
./app/models/concerns/.keep
./app/models/application_record.rb
./app/helpers/booklist_helper.rb
./app/helpers/application_helper.rb
./app/javascript/channels/consumer.js
./app/javascript/channels/index.js
./app/javascript/packs/application.js
./app/channels/application_cable/channel.rb
./app/channels/application_cable/connection.rb
./app/controllers/booklist_controller.rb
./app/controllers/booklist_controller.rb.bak
./app/controllers/application_controller.rb
./app/controllers/booklist_controller.rb.org
./app/controllers/booklist_controller.rb.bak~
./app/controllers/concerns/.keep
./app/views/layouts/application.html.erb
./app/views/layouts/mailer.text.erb
./app/views/layouts/mailer.html.erb
./app/views/booklist/hello.html.erb
kiri@smtp:~/work/rails/books[1056]%
なお,環境は↓の通りです.
kiri@smtp:~/work/rails/books[1056]% rails --version
Rails 6.1.7.6
kiri@smtp:~/work/rails/books[1057]% pkg info -aI|grep ^rubygem-
rubygem-actioncable61-6.1.7.6 Integrated WebSockets for Rails
rubygem-actionmailbox61-6.1.7.6 Receive and process incoming emails in Rails applications
rubygem-actionmailer61-6.1.7.6 Easy email delivery and testing for Ruby
rubygem-actionpack4-4.2.11.3 Action Controller and Action View of Rails MVC Framework
rubygem-actionpack61-6.1.7.6 Action Controller and Action View of Rails MVC Framework
rubygem-actiontext61-6.1.7.6 Edit and display rich text in Rails applications
rubygem-actionview4-4.2.11.3 Rendering framework putting the V in MVC (part of Rails)
rubygem-actionview61-6.1.7.6 Rendering framework putting the V in MVC (part of Rails)
rubygem-activejob61-6.1.7.6 Job class declarations for a variety of queueing backends
rubygem-activemodel4-4.2.11.3 Toolkit for building modeling frameworks
rubygem-activemodel61-6.1.7.6 Toolkit for building modeling frameworks
rubygem-activerecord61-6.1.7.6 Object-relational mapping layer for Rails MVC Framework
rubygem-activestorage61-6.1.7.6 Attach cloud and local files in Rails applications
rubygem-activesupport4-4.2.11.3 Utility classes and extension that are required by Rails MVC Framework
rubygem-activesupport61-6.1.7.6 Utility classes and extension that are required by Rails MVC Framework
rubygem-addressable-2.8.5 Replacement for the URI implementation
rubygem-bindex-0.8.1 Bindings for your Ruby exceptions
rubygem-binding_of_caller-1.0.0 Retrieve the binding of a methods caller
rubygem-bootsnap-1.16.0 Boot large ruby/rails apps faster
rubygem-builder-3.2.4 Facilitate programmatic generation of XML markup
rubygem-bundler-2.4.20,1 Tool that manages gem dependencies for Ruby applications
rubygem-byebug-11.1.3 Ruby 2 debugger
rubygem-capybara-3.39.2 Integration testing tool for rack based web applications
rubygem-colorator-1.1.0 Colorize your text in the terminal
rubygem-concurrent-ruby-1.2.2 Modern concurrency tools for Ruby
rubygem-connection_pool-2.4.1 Generic connection pool for Ruby
rubygem-crack-0.4.5 Ruby Library of Simple JSON and XML Parsing
rubygem-crass-1.0.6 CSS parser based on the CSS Syntax Level 3 draft
rubygem-dalli-3.2.6 High performance memcached client for Ruby
rubygem-date-3.3.3 Subclass of Object includes Comparable module for handling dates
rubygem-debug-1.8.0 Debugging functionality for Ruby
rubygem-debug_inspector-1.1.0 Ruby wrapper for the MRI 2.0 debug_inspector API
rubygem-em-websocket-0.5.3 EventMachine based WebSocket server
rubygem-erubi-1.12.0 ERB template engine for Ruby
rubygem-erubis-2.7.0_1 Fast, secure, and extensible implementation of eRuby
rubygem-eventmachine-1.2.7 Fast, simple event-processing library for Ruby programs
rubygem-execjs-2.9.1 ExecJS lets you run JavaScript code from Ruby
rubygem-ffi-1.16.3 Extension for dynamic libraries and binding functions
rubygem-forwardable-extended-2.6.0 Forwardable with hash, and instance variable extensions
rubygem-globalid-rails61-1.2.1 URIs for your models makes it easy to pass references around
rubygem-graphql-1.13.19 Plain-Ruby implementation of GraphQL
rubygem-graphql-client-0.16.0_1 Ruby library for declaring, composing and executing GraphQL queries
rubygem-hashdiff-1.0.1 Diff lib to compute the smallest difference between two hashes
rubygem-http_parser.rb-0.8.0 Simple callback-based HTTP request/response parser
rubygem-i18n-1.14.1,2 New wave Internationalization support for Ruby
rubygem-image_processing-1.12.2_1 High-level wrapper for processing images for the web with ImageMagick or libvips
rubygem-io-console-0.6.0 Add console capabilities to IO instances
rubygem-irb-1.8.1 Interactive Ruby
rubygem-jbuilder-rails61-2.11.5 Create JSON structures via a Builder-style DSL
rubygem-jekyll-4.3.2 Simple, blog aware, static site generator
rubygem-jekyll-feed-0.17.0 Generates an Atom feed from Jekyll posts
rubygem-jekyll-sass-converter-2.2.0 Basic Sass converter for Jekyll
rubygem-jekyll-seo-tag-2.8.0 Add metadata tags for search engines and social networks
rubygem-jekyll-sitemap-1.4.0 Automatically generate a sitemap.xml for Jekyll sites
rubygem-jekyll-watch-2.2.1 Handles rebuilding of Jekyll sites when a file changes
rubygem-json-2.6.3 Parse JSON texts and generate them from ruby data structures
rubygem-kramdown-2.4.0 Yet-another-markdown-parser but fast, pure Ruby
rubygem-kramdown-parser-gfm-1.1.0 Kramdown parser for the GFM dialect of Markdown
rubygem-libxml-ruby-4.1.1 Ruby language bindings for the GNOME Libxml2 XML toolkit
rubygem-liquid4-4.0.4 Library for rendering safe templates
rubygem-listen-3.8.0 Listen to file modifications and notify about the changes
rubygem-loofah-2.21.3 Library for manipulating HTML/XML documents and fragments
rubygem-mail-2.8.1,2 Ruby email handler
rubygem-marcel-1.0.2 Simple mime type detection
rubygem-matrix-0.4.2 Implementation of Matrix and Vector classes
rubygem-mercenary-0.4.0 Lightweight and flexible library for writing command-line apps in Ruby
rubygem-method_source-1.0.0 Tool to retrieve the sourcecode for a method
rubygem-mini_magick-4.12.0_1 Manipulate images with minimal use of memory via ImageMagick
rubygem-mini_mime-1.1.5 Lightweight mime type lookup toy
rubygem-minima-2.5.1 Beautiful, minimal theme for Jekyll
rubygem-minitest-5.20.0 Minitest provides a complete suite of testing facilities
rubygem-msgpack-1.7.2 Gems for MessagePack
rubygem-net-imap-0.4.0 Ruby client api for Internet Message Access Protocol
rubygem-net-pop-0.1.2 Ruby client library for POP3
rubygem-net-protocol-0.2.1 Abstruct interface for net-* client
rubygem-net-smtp-0.4.0 Simple Mail Transfer Protocol client library for Ruby
rubygem-nio4r-2.5.9 Cross-platform asynchronous I/O primitives
rubygem-nokogiri-1.15.4 HTML, XML, SAX, and Reader parser
rubygem-pathutil-0.16.2 Like Pathname but a little less insane
rubygem-psych-5.1.0 YAML parser and emitter
rubygem-public_suffix-5.0.1_9 Ruby domain name parser based on the Public Suffix List
rubygem-puma-6.4.0 Fast, multithreaded and highly concurrent ruby web server
rubygem-que-2.2.1 Job queue that uses PostgreSQL advisory locks for speed and reliability
rubygem-racc-1.7.1 LALR(1) parser generator for Ruby
rubygem-rack-3.0.8,3 Rack, a modular Ruby web server interface
rubygem-rack-cache-1.14.0 Rack middleware to enable HTTP caching
rubygem-rack-mini-profiler-3.1.1 Profiles loading speed for rack applications
rubygem-rack-proxy-0.7.7 Request/response rewriting proxy capabilities with streaming
rubygem-rack-test-2.1.0 Small, simple testing API for Rack apps
rubygem-rack16-1.6.13 Rack, a modular Ruby web server interface
rubygem-rack22-2.2.8,3 Rack, a modular Ruby web server interface
rubygem-rails-deprecated_sanitizer-1.0.4 Deprecated sanitizer API extracted from Action View
rubygem-rails-dom-testing-rails61-2.2.0 Analyse and compare DOMs using Nokogiri
rubygem-rails-dom-testing1-1.0.9 Analyse and compare DOMs using Nokogiri
rubygem-rails-html-sanitizer-1.6.0 Sanitize HTML fragments in Rails applications
rubygem-rails61-6.1.7.6 Full-stack web application framework
rubygem-railties61-6.1.7.6 Rails internals bootup, plugins, generators, and rake tasks
rubygem-rake-13.0.6 Ruby Make
rubygem-rb-fsevent-0.11.2 FSEvents API with Signals catching (without RubyCocoa)
rubygem-rb-inotify-0.10.1 Ruby wrapper for libinotify, using ffi
rubygem-rb-kqueue-0.2.8 Ruby wrapper for BSD kqueue, using FFI
rubygem-rdoc-6.5.0 RDoc produces HTML and command-line documentation for Ruby projects
rubygem-redis-5.0.7 Ruby client library for Redis, the key value storage server
rubygem-redis-client-0.17.0 Simple low-level client for Redis 6+
rubygem-redis-namespace-1.11.0 Ruby client class for Redis with namespace support
rubygem-regexp_parser-2.7.0 Tokenizing, lexinf and parsing Ruby regular expressions
rubygem-reline-0.3.9 Alternative GNU Readline or Editline implementation by pure Ruby
rubygem-rexml-3.2.6 XML toolkit for Ruby
rubygem-rouge-4.1.3 Simple, easy-to-extend drop-in replacement for pygments
rubygem-ruby-vips-2.1.4_1 Binding for the vips image processing library
rubygem-rubyzip-2.3.2 Ruby module for reading and writing zip files
rubygem-safe_yaml-1.0.5 Parse YAML safely
rubygem-sass-rails-rails61-6.0.0 Sass adapter for the Rails asset pipeline
rubygem-sassc-2.4.0 Use libsass with Ruby
rubygem-sassc-rails-rails61-2.1.2 Integrate SassC-Ruby into Rails
rubygem-sassc22-2.2.1 Use libsass with Ruby
rubygem-selenium-webdriver-4.13.1 Tool for writing automated tests of websites
rubygem-semantic_range-3.0.0 Parse and compare semantic version numbers and ranges
rubygem-spring-4.1.1 Rails application preloader
rubygem-sprockets-rails-rails61-3.4.2 Sprockets Rails integration
rubygem-sprockets3-3.7.2_1 Ruby library that preprocesses and concatenates JavaScript files
rubygem-sqlite3-1.6.6 Ruby interface to the SQLite DB engine version 3
rubygem-stringio-3.0.8 Pseudo IO class from/to String
rubygem-sucker_punch-3.1.0 Asynchronous processing library for Ruby
rubygem-terminal-table-3.0.2 Simple, feature rich ASCII table generation library
rubygem-thor-1.2.2 Scripting framework that replaces rake, sake, and rubigen
rubygem-thread_safe-0.3.6 Thread-safe collections and utilities for Ruby
rubygem-tilt-2.3.0 Generic interface to multiple Ruby template engines
rubygem-timeout-0.4.0 Auto-terminate potentially long-running operations in Ruby
rubygem-turbolinks-5.2.1 Turbolinks makes following links in your web application faster
rubygem-turbolinks-source-5.2.0 Turbolinks JavaScript assets
rubygem-tzinfo-2.0.6 Daylight-savings aware timezone support for Ruby
rubygem-tzinfo1-1.2.11 Daylight-savings aware timezone support for Ruby
rubygem-uglifier-4.2.0 Ruby wrapper for UglifyJS JavaScript compressor
rubygem-unicode-display_width-2.5.0 Get the display size of a string
rubygem-web-console-rails61-4.2.1 Debugging tool for your Ruby on Rails applications
rubygem-webdrivers-5.3.1 Run Selenium tests more easily with install and updates for all supported webdrivers
rubygem-webmock-3.19.1 Allows stubbing HTTP requests and setting expectations on the requests
rubygem-webpacker-rails61-5.4.4 Use Webpack to manage app-like JavaScript modules in Rails
rubygem-webrick-1.8.1 HTTP server toolkit
rubygem-websocket-1.2.10 Universal Ruby library to handle WebSocket protocol
rubygem-websocket-driver-0.7.6 WebSocket protocol handler with pluggable I/O
rubygem-websocket-extensions-0.1.5 Generic extension manager for WebSocket connections
rubygem-xpath-3.2.0 DSL for generating XPath Expressions
rubygem-zeitwerk-2.6.12 Efficient and thread-safe code loader
kiri@smtp:~/work/rails/books[1058]% ruby --version
ruby 3.3.0preview2 (2023-09-14 master e50fcca9a7) [amd64-freebsd15]
kiri@smtp:~/work/rails/books[1059]% uname -a
FreeBSD smtp 15.0-CURRENT FreeBSD 15.0-CURRENT #0 n265729-9b03a5de73d4-dirty: Tue Oct 10 18:39:54 JST 2023 root@msrvkx:/usr/obj/usr/src/amd64.amd64/sys/XIJ amd64
kiri@smtp:~/work/rails/books[1060]%
---
きりやま
1
1
Ruby 3.3.0 が公開されました。Ruby
3.3ではPrismという新しいパーサーの追加、新しいパーサージェネレーターであるLramaによるBisonの置き換え、RJITという新たなJITの仕組みを追加、YJITの高速化など様々な改善が行われています。
## Prism
* default gemとして[Prismパーサ](https://github.com/ruby/prism)を導入しました。
* Prismは、Ruby言語のためのポータブルで、エラートレラントで、保守可能な再帰下降パーサです。
* Prismは本番環境で使用する準備が整っており、積極的にメンテナンスされています。Ripperの代わりに使用することができます。
* Prismの使用方法については、[詳細なドキュメンテーション](https://ruby.github.io/prism/)があります。
* Prismは、CRubyに内部的に使用されるCライブラリと、Rubyコードを解析する必要がある任意のツールに使用できるRuby
gemの2つのコンポーネントを持っています。
* Prism APIの注目すべきメソッドには以下のものがあります。
* `Prism.parse(source)` は、パース結果オブジェクトの一部としてASTを返します。
* `Prism.parse_comments(source)` はコメントを返します。
* `Prism.parse_success?(source)` はエラーがない場合にtrueを返します。
* Prism開発への貢献に興味がある場合は、[Prismリポジトリ](https://github.com/ruby/prism)に直接Pull
RequestやIssueを作成することができます。
* 今後は `ruby --parser=prism` または `RUBYOPT="--parser=prism"`
を使用してPrismコンパイラを試すことができます。ただし、このフラグはデバッグ用であることに注意してください。
## Bisonの代わりにLramaを使用
* Bisonを[Lrama LALRパーサジェネレータ](https://github.com/ruby/lrama)に置き換えました。
[[Feature #19637]](https://bugs.ruby-lang.org/issues/19637)
* 興味がある方は、[The future vision of Ruby
Parser](https://rubykaigi.org/2023/presentations/spikeolaf.html)という発表をご覧くださ…
* 参考:[Ruby Parser開発日誌 (5) - Lrama LALR (1) parser
generatorを実装した](https://yui-knk.hatenablog.com/entry/2023/03/13/101951)
* Lramaの内部パーサは、保守性のためにRaccによって生成されたLRパーサに置き換えられました。
* パラメータ化ルール `(?, *, +)` がサポートされ、CRubyのparse.yで使用されます。
## YJIT
* 大幅なパフォーマンスの改善
* `*` を使った引数のサポートが改善されました。
* 仮想マシンのスタック操作のためにレジスタが使われるようになりました。
* オプション引数を持つ呼び出しで全ての組合せがコンパイルされます。例外ハンドラもコンパイルされます。
* サポートされていない呼び出し方や分岐の数の多い呼出しでのインタプリタへのフォールバックが行なわれなくなりました。
* Railsの `#blank?` や [特別化された
`#present?`](https://github.com/rails/rails/pull/49909)
などの単純なメソッドがインライン化されます。
* `Integer#*`、`Integer#!=`、`String#!=`、`String#getbyte`、`Kernel#block_given?`、`Kernel#is_a?`、`Kernel#instance_of?`、および
`Module#===` が特別に最適化されます。
* コンパイル速度はRuby 3.2よりわずかに速くなりました。
* Optcarrotでは、インタプリタよりも3倍以上速くなりました!
* メモリ使用量の大幅な改善
* コンパイルされたコードのメタデータは、はるかに少ないメモリを使用します。
* アプリケーションが4万個以上のISEQを持つ場合、`--yjit-call-threshold` は自動的に30から120に上げられます。
* 呼出しの少ないISEQのコンパイルをスキップするために `--yjit-cold-threshold` が追加されました。
* Arm64ではよりコンパクトなコードが生成されます。
* コードGCはデフォルトで無効になりました
* `--yjit-exec-mem-size` は新しいコードのコンパイルが停止するハードリミットとして扱われます。
* これにより、デフォルトではコードGC実行によるパフォーマンスの急激な低下がなくなりました。[Pitchfork](https://github.com…
を使って定期的にforkするサーバーでのコピーオンライトの挙動が改善されました。
* 必要に応じて `--yjit-code-gc` でコードGCを有効にすることもできます。
* `RubyVM::YJIT.enable` を追加し、実行時にYJITを有効にできるようにしました
* コマンドライン引数や環境変数を変更せずにYJITを開始できます。Rails 7.2はこの方法を使用して
[デフォルトでYJITを有効にします](https://github.com/rails/rails/pull/49947)。
* これはまた、アプリケーションの起動が完了した後にのみYJITを有効にするために使用できます。YJITの他のオプションを使用しながら起動時にYJITを無効にしたい場合は、`--yjit-disable`
を使用できます。
* デフォルトで利用可能なYJITの統計が増えました
* `yjit_alloc_size` およびその他いくつかのメタデータ関連の統計がデフォルトで利用可能になりました。
* `--yjit-stats` によって生成される `ratio_in_yjit`
統計は、リリースビルドで利用可能になりました。特別な統計や開発ビルドは、ほとんどの統計にアクセスするためにはもはや必要ありません。
* プロファイリング機能を追加
* Linux perfでのプロファイリングを容易にするために `--yjit-perf` が追加されました。
* `--yjit-trace-exits` は、`--yjit-trace-exits-sample-rate=N`
を使用したサンプリングをサポートします。
* より網羅的なテストと複数のバグ修正
## RJIT
* Rubyで書かれたJITコンパイラであるRJITを導入し、MJITを置き換えました。
* RJITはUnixプラットフォーム上のx86\_64アーキテクチャのみをサポートします。
* MJITとは異なり、実行時にCコンパイラを必要としません。
* RJITは実験的な目的のためだけに存在します。
* 本番環境ではYJITを引き続き使用してください。
* RubyのJITの開発に興味がある場合は、[RubyKaigiの3日目のk0kubunの発表](https://rubykaigi.org/2023/…
## M:N スレッドスケジューラ
* M:N スレッドスケジューラが導入されました。[[Feature
#19842]](https://bugs.ruby-lang.org/issues/19842)
* M個のRuby スレッドを、N個のネイティブスレッド(OSスレッド)で管理するので、生成管理のコストを抑えることができるようになりました。
* C拡張ライブラリの互換性に問題が生じる可能性があるため、メインRactorでのM:Nスレッドスケジューラはデフォルトでは無効にされています。
* `RUBY_MN_THREADS=1` と環境変数を設定することで、メインRactorでM:Nスレッドスケジューラを有効にします。
* メインRactor以外ではM:Nスレッドスケジューラが常に有効です。
* `RUBY_MAX_CPU=n` と環境変数を設定することで、Nの最大数(利用するネイティブスレッドの最大数)を設定できます。デフォルトは8です。
* 一つの Ractor
ではたかだか1つのスレッドしか同時に実行されないので、実際に利用するネイティブスレッド数は、`RUBY_MAX_CPU`で指定した数か実行中のRactorの数の少ないほうになります。つまり、Ractorの数が1つのアプリケーション(多くのアプリケーション)では1つのネイティブスレッドだけ利用されます。
* ブロックする処理をサポートするため、N個以上のネイティブスレッドが利用されることがあります。
## パフォーマンスの改善
* `defined?(@ivar)` is optimized with Object Shapes.
* `Socket.getaddrinfo` などの名前解決を中断できるようになりました (pthread
が利用できる環境のみ)。[[Feature 19965]](https://bugs.ruby-lang.org/issues/19965)
* 環境変数 `RUBY_GC_HEAP_REMEMBERED_WB_UNPROTECTED_OBJECTS_LIMIT_RATIO`
が追加されました。[[Feature #19571]](https://bugs.ruby-lang.org/issues/19571)
* GCで古いオブジェクトの子オブジェクトがすぐにプロモートされなくなりました。[[Feature
#19678]](https://bugs.ruby-lang.org/issues/19678)
* GCに弱参照が追加されました。[[Feature #19783]](https://bugs.ruby-lang.org/issues/19783)
## その他の注目すべき 3.2 からの変更点
### IRB
IRBは様々な機能強化を行いました。主なものは以下の通りです。
* IRBとrdbgの連携 pry-byebugのような使い心地でデバッグできるようになりました。([使い方](https://github.com/ruby/irb#debug…
* lsコマンドやshow_cmdsの出力がPagerで表示されるようになりました。
* lsコマンドやshow_sourceコマンドがより便利で詳細な情報を出力するようになりました。
* 型情報を使った補完が実験的に実装されました。([有効化するには](https://github.com/ruby/irb#type-based-com…
* Reline::Faceクラスの導入により、補完ダイアログの色や文字装飾を変更できるようになりました。([使い方](https://github.co…
また、機能強化以外にも、数多くのバグ修正および将来的な機能拡張を見越した大規模なリファクタリングを行ないました。
## 互換性に関する変更
* ブロック内での引数なし `it` の呼び出しは非推奨になりました。
Ruby 3.4から最初のブロック引数を参照するようになります。
[[Feature #18980]](https://bugs.ruby-lang.org/issues/18980)
### 環境変数の削除
以下の非推奨の環境変数は削除されました
* 環境変数 `RUBY_GC_HEAP_INIT_SLOTS` は非推奨になり、何もしなくなりました。環境変数
`RUBY_GC_HEAP_{0,1,2,3,4}_INIT_SLOTS` を使ってください。[[Feature
#19785]](https://bugs.ruby-lang.org/issues/19785)
## 標準添付ライブラリの互換性に関する変更
### `ext/readline` の削除
* 今後は Ruby で書かれた GNU Readline の互換ライブラリである `reline`
をすべての環境で標準で利用し、`ext/readline` は削除されました。以前の `ext/readline` が必要なユーザーは
`gem install readline-ext` でインストールすることができます。
* この変更により、Ruby のインストール時に `libreadline` や `libedit` などのライブラリのインストールは不要となります。
## 標準添付ライブラリのアップデート
RubyGems と Bundler は将来リリースされる Ruby で bundled gems となる予定の gem が Gemfile
または gemspec に存在しない状態で require された際に警告を行う機能が追加されました。
この警告は bootsnap gem を使っている場合には 3.3.0 の時点では機能上の制限により出力されません。そのため、環境変数として
`DISABLE_BOOTSNAP=1` などを設定して、少なくとも1度はアプリケーションを実行することを推奨します。
以下のライブラリが警告の対象となります。
* abbrev
* base64
* bigdecimal
* csv
* drb
* getoptlong
* mutex_m
* nkf
* observer
* racc
* resolv-replace
* rinda
* syslog
以下の default gem が追加されました。
* prism 0.19.0
以下の default gems のバージョンがアップデートされました。
* RubyGems 3.5.3
* abbrev 0.1.2
* base64 0.2.0
* benchmark 0.3.0
* bigdecimal 3.1.5
* bundler 2.5.3
* cgi 0.4.1
* csv 3.2.8
* date 3.3.4
* delegate 0.3.1
* drb 2.2.0
* english 0.8.0
* erb 4.0.3
* error_highlight 0.6.0
* etc 1.4.3
* fcntl 1.1.0
* fiddle 1.1.2
* fileutils 1.7.2
* find 0.2.0
* getoptlong 0.2.1
* io-console 0.7.1
* io-nonblock 0.3.0
* io-wait 0.3.1
* ipaddr 1.2.6
* irb 1.11.0
* json 2.7.1
* logger 1.6.0
* mutex_m 0.2.0
* net-http 0.4.0
* net-protocol 0.2.2
* nkf 0.1.3
* observer 0.1.2
* open-uri 0.4.1
* open3 0.2.1
* openssl 3.2.0
* optparse 0.4.0
* ostruct 0.6.0
* pathname 0.3.0
* pp 0.5.0
* prettyprint 0.2.0
* pstore 0.1.3
* psych 5.1.2
* rdoc 6.6.2
* readline 0.0.4
* reline 0.4.1
* resolv 0.3.0
* rinda 0.2.0
* securerandom 0.3.1
* set 1.1.0
* shellwords 0.2.0
* singleton 0.2.0
* stringio 3.1.0
* strscan 3.0.7
* syntax_suggest 2.0.0
* syslog 0.1.2
* tempfile 0.2.1
* time 0.3.0
* timeout 0.4.1
* tmpdir 0.2.0
* tsort 0.2.0
* un 0.3.0
* uri 0.13.0
* weakref 0.1.3
* win32ole 1.8.10
* yaml 0.3.0
* zlib 3.1.0
新たに以下の gem が default gems から bundled gems に変更されました。
* racc 1.7.3
以下の bundled gems のバージョンがアップデートされました。
* minitest 5.20.0
* rake 13.1.0
* test-unit 3.6.1
* rexml 3.2.6
* rss 0.3.0
* net-ftp 0.3.3
* net-imap 0.4.9
* net-smtp 0.4.0
* rbs 3.4.0
* typeprof 0.21.9
* debug 1.9.1
default gems と bundled gems の詳細については [Logger の GitHub
Releases](https://github.com/ruby/logger/releases) のような GitHub
releases または changelog ファイルを参照してください。
その他詳細については、[NEWS](https://github.com/ruby/ruby/blob/v3_3_0/NEWS.md)
ファイルまたは[コミットログ](https://github.com/ruby/ruby/compare/v3_2_0...v3_3_0)を参照してく…
なお、こうした変更により、Ruby 3.2.0 以降では [5532 個のファイルに変更が加えられ、326851 行の追加と 185793
行の削除が行われました](https://github.com/ruby/ruby/compare/v3_2_0...v3_3_0#file_buck…
!
メリークリスマス、Ruby 3.3 とともによいお年をお迎えください!
## ダウンロード
* <https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.0.tar.gz>
SIZE: 22065999
SHA1: 1a7e56851bf29bda1183aca99b3b323c58e0187b
SHA256: 96518814d9832bece92a85415a819d4893b307db5921ae1f0f751a9a89a56b7d
SHA512: 26074009b501fc793d71a74e419f34a6033c9353433919ca74ba2d24a3de432dbb11fd92c2bc285f0e4d951a6d6c74bf5b69a2ab36200c8c26e871746d6e0fc6
* <https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.0.tar.xz>
SIZE: 16345456
SHA1: c8f68e1b0a114b90460a0b44165a3b2f540fa5b6
SHA256: 676b65a36e637e90f982b57b059189b3276b9045034dcd186a7e9078847b975b
SHA512: 7959c5753bfa0bfc4d6d74060869aabbe9815c1c97930659da11b917ee0803ddbbd80e869e00c48b8694b4ba48709c3b6493fd045568e36e902616c35ababf01
* <https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.0.zip>
SIZE: 26935108
SHA1: a433eef1d7f96daeaf3b4cb842d0ed2dd82e7dc1
SHA256: 0e6563f679dd3694732eb3addf9de681c67b584602ac574376b60e7a509d2cd8
SHA512: a94a85937a14b217c1f4b90d24185289ed4aee79239c4f3eecf8034d3fd34e65ee8d66869473857ed153067188adc9b70c0471e4ebe842c9f98ef60c34090450
## Ruby とは
Rubyはまつもとゆきひろ (Matz)
によって1993年に開発が始められ、今もオープンソースソフトウェアとして開発が続けられています。Rubyは様々なプラットフォームで動き、世界中で、特にWebアプリケーション開発のために使われています。
3
4