使用 WSL Kali 滚动。我正在尝试按照超堆栈文档中的教程制作演示项目(此处),但是当我尝试实际运行服务器时,热加载程序会抛出“没有这样的文件或目录”错误,并最终在退出后导致 SIGKILL代码 1. 实际的服务器似乎运行良好。我已经非常严格地遵循了指示,所以我认为它可能与 WSL 有关,但我无法弄清楚该怎么做。
我尝试运行应用程序时的控制台输出如下。
$ bundle exec foreman start
19:01:45 web.1 | started with pid 13050
19:01:45 hot-loader.1 | started with pid 13051
19:01:46 hot-loader.1 | /var/lib/gems/2.7.0/gems/listen-3.7.0/lib/listen/adapter/config.rb:16:in `realpath': No such file or directory @ rb_check_realpath_internal - app/hyperstack (Errno::ENOENT)
19:01:46 hot-loader.1 | from /var/lib/gems/2.7.0/gems/listen-3.7.0/lib/listen/adapter/config.rb:16:in `realpath'
19:01:46 hot-loader.1 | from /var/lib/gems/2.7.0/gems/listen-3.7.0/lib/listen/adapter/config.rb:16:in `block in initialize'
19:01:46 hot-loader.1 | from /var/lib/gems/2.7.0/gems/listen-3.7.0/lib/listen/adapter/config.rb:15:in `map'
19:01:46 hot-loader.1 | from /var/lib/gems/2.7.0/gems/listen-3.7.0/lib/listen/adapter/config.rb:15:in `initialize'
19:01:46 hot-loader.1 | from /var/lib/gems/2.7.0/gems/listen-3.7.0/lib/listen/backend.rb:27:in `new'
19:01:46 hot-loader.1 | from /var/lib/gems/2.7.0/gems/listen-3.7.0/lib/listen/backend.rb:27:in `initialize'
19:01:46 hot-loader.1 | from /var/lib/gems/2.7.0/gems/listen-3.7.0/lib/listen/listener.rb:49:in `new'
19:01:46 hot-loader.1 | from /var/lib/gems/2.7.0/gems/listen-3.7.0/lib/listen/listener.rb:49:in `initialize'
19:01:46 hot-loader.1 | from /var/lib/gems/2.7.0/gems/listen-3.7.0/lib/listen.rb:30:in `new'
19:01:46 hot-loader.1 | from /var/lib/gems/2.7.0/gems/listen-3.7.0/lib/listen.rb:30:in `to'
19:01:46 hot-loader.1 | from /var/lib/gems/2.7.0/gems/hyperstack-config-1.0.alpha1.8/lib/hyperstack/hotloader/server.rb:106:in `loop'
19:01:46 hot-loader.1 | from /var/lib/gems/2.7.0/gems/hyperstack-config-1.0.alpha1.8/bin/hyperstack-hotloader:22:in `<top (required)>'
19:01:46 hot-loader.1 | from /usr/local/bin/hyperstack-hotloader:23:in `load'
19:01:46 hot-loader.1 | from /usr/local/bin/hyperstack-hotloader:23:in `<main>'
19:01:46 hot-loader.1 | Listening on port 25222, watching for changes in app/hyperstack, app/assets/stylesheets
19:01:46 web.1 | => Booting Puma
19:01:46 web.1 | => Rails 6.1.4.1 application starting in development
19:01:46 web.1 | => Run `bin/rails server --help` for more startup options
19:01:46 hot-loader.1 | exited with code 1
19:01:46 system | sending SIGTERM to all processes
19:01:47 web.1 | Puma starting in single mode...
19:01:47 web.1 | * Puma version: 5.5.0 (ruby 2.7.4-p191) ("Zawgyi")
19:01:47 web.1 | * Min threads: 5
19:01:47 web.1 | * Max threads: 5
19:01:47 web.1 | * Environment: development
19:01:47 web.1 | * PID: 13050
19:01:47 web.1 | * Listening on http://0.0.0.0:5000
19:01:47 web.1 | Use Ctrl-C to stop
19:01:51 system | sending SIGKILL to all processes
另外,这是我的hyperstack.rb
文件
# Hyperstack.import 'react/react-source-browser' # uncomment this line if you want hyperstack to use its copy of react
Hyperstack.import 'hyperstack/hotloader', client_only: true if Rails.env.development?
Hyperstack.import 'hyperstack/component/jquery', client_only: true
# server_side_auto_require will patch the ActiveSupport Dependencies module
# so that you can define classes and modules with files in both the
# app/hyperstack/xxx and app/xxx directories. For example you can split
# a Todo model into server and client related definitions and place this
# in `app/hyperstack/models/todo.rb`, and place any server only definitions in
# `app/models/todo.rb`.
require "hyperstack/server_side_auto_require.rb"
# set the component base class
Hyperstack.component_base_class = 'HyperComponent' # i.e. 'ApplicationComponent'
# prerendering is default :off, you should wait until your
# application is relatively well debugged before turning on.
Hyperstack.prerendering = :off # or :on
# add this line if you need jQuery AND ARE NOT USING WEBPACK
# Hyperstack.import 'hyperstack/component/jquery', client_only: true
# change definition of on_error to control how errors such as validation
# exceptions are reported on the server
module Hyperstack
def self.on_error(operation, err, params, formatted_error_message)
::Rails.logger.debug(
"#{formatted_error_message}\n\n" +
Pastel.new.red(
'To further investigate you may want to add a debugging '\
'breakpoint to the on_error method in config/initializers/hyperstack.rb'
)
)
end
end if Rails.env.development?