ruby-on-rails - 终端重启后路由丢失。 rails 5.0.1

标签 ruby-on-rails ruby windows-10 ruby-on-rails-5

这几天我一直在寻找答案,但一无所获。我知道有很多类似的问题,但他们帮不了我。

我已经开始使用 http://guides.rubyonrails.org/getting_started.html 学习 Rails并一直向前直到终端重启。这是错误消息和代码示例:

walker@DESKTOP-L15NDIS:~/blog$ rails routes
/home/walker/.rvm/gems/ruby-2.3.1/gems/railties-5.0.1/lib/rails/app_loader.rb:40:
warning: Insecure world writable dir
/home/walker/.rvm/gems/ruby-2.3.1@global/bin in PATH, mode 040777
config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:

   * development - set it to false
   * test - set it to false (unless you use a tool that preloads your test environment)
   * production - set it to true

 You don't have any routes defined!

 Please add some routes in config/routes.rb.

 For more information about routes, see the Rails guide: http://guides.rubyonrails.org/routing.html.

routes.rb:

Rails.application.routes.draw do
    root 'welcome#index'
    resources :articles
end

config/environments/development.rb:

 config.eager_load = false

config/environments/test.rb:

config.eager_load = false 

config/environments/production.rb

config.eager_load = true

启动服务器:

 walker@DESKTOP-L15NDIS:~/blog$ rails s
 /home/walker/.rvm/gems/ruby-2.3.1/gems/railties-5.0.1/lib/rails/app_loader.rb:40:
 warning: Insecure world writable dir /home/walker/.rvm/gems/ruby-2.3.1@global/bin in PATH, mode 040777
 => Booting Puma
 => Rails 5.0.1 application starting in development on http://localhost:3000
 => Run `rails server -h` for more startup options
 config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:

   * development - set it to false
   * test - set it to false (unless you use a tool that preloads your test environment)
   * production - set it to true

 Puma starting in single mode...
 * Version 3.7.0 (ruby 2.3.1-p112), codename: Snowy Sagebrush
 * Min threads: 5, max threads: 5
 * Environment: development
 * Listening on tcp://0.0.0.0:3000
 Use Ctrl-C to stop

本地主机显示错误信息:

The page you were looking for doesn't exist.

You may have mistyped the address or the page may have moved.

控制台输出:

Started GET "/" for 127.0.0.1 at 2017-02-01 16:59:46 +0200 Started GET
"/" for 127.0.0.1 at 2017-02-01 16:59:46 +0200

ActionController::RoutingError (No route matches [GET] "/"):

ActionController::RoutingError (No route matches [GET] "/"):

actionpack (5.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:53:in `call'
web-console (3.4.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.4.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `catch'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.1) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.0.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.1) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.0.1) lib/rails/rack/logger.rb:24:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
railties (5.0.1) lib/rails/engine.rb:522:in `call'
puma (3.7.0) lib/puma/configuration.rb:226:in `call'
puma (3.7.0) lib/puma/server.rb:578:in `handle_request'
puma (3.7.0) lib/puma/server.rb:415:in `process_client'
puma (3.7.0) lib/puma/server.rb:275:in `block in run'
puma (3.7.0) lib/puma/thread_pool.rb:120:in `block in spawn_thread'

您有什么建议来解决这个问题?

注意:所有这些东西在终端重启之前都运行良好。

附言我创建了另一个应用程序,它在终端重启之前运行良好。

附言我在 Windows 10 专业版上运行 Linux 子系统。

P.P.P.S.我不能使用任何 Linux 发行版或购买 MacBook

最佳答案

对我来说,系统似乎对您的主文件夹的访问权限有问题。

尝试运行 sudo chmod go-w/home/walker 如果其他路径出现问题,请执行相同的操作。

检查相似 question .如果您想在没有“基础设施”问题的情况下尝试 Rails,请查看 https://www.railstutorial.org/以及他们对 cloud9 环境的选择。

关于ruby-on-rails - 终端重启后路由丢失。 rails 5.0.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41983762/

相关文章:

docker - 无法在Windows 10上减小Docker最大磁盘镜像大小

MySQL-Wamp 服务器在 win10 升级后不工作

ruby-on-rails - 将方法添加到 Rails 中的模型时出现未定义的方法错误

ruby-on-rails - ActionView::Template::Error(未预编译):在 heroku cedar 上

ruby-perf 无法通过 bundler 安装,但可以通过命令行安装

ruby-on-rails - 如何在 rails 中按行计数?

c# - 打开文件时,Visual Studio 2013崩溃

mysql - 在使用 Active Record 查询的最佳条件下哪种方式更好

ruby-on-rails - rails |如何在生产中查看实时服务器日志?

ruby-on-rails - Ruby 简单搜索表单错误