1

我刚刚完成了Daniel Kehoe 详细且解释清楚的 Rails 教程,最后我正在尝试使用 Rails Composer。我在 Cloud 9 和 Windows 10 上创建应用程序时遇到了同样的错误。该应用程序只创建了一个基本的 Rails 应用程序,而不是具有所有额外功能的 Rails Composer 应用程序。

首先,我尝试使用以下命令创建新项目:

rails new rails-devise-roles -m https://raw.github.com/RailsApps/rails-composer/master/composer

并得到以下错误:

C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/open-uri.rb:358:in `open_http': 404 Not Found (OpenURI::HTTPError)

我试图在此文件中找到第 358 行,但在目录 C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0 中似乎没有要检查的“open-uri.rb”文件。

以下是完整的应用程序创建命令和结果:

C:\>rails new rails-devise-roles -m https://raw.github.com/RailsApps/rails-composer/master/composer
      create
      create  README.md
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
         run  git init from "."
Initialized empty Git repository in C:/rails-devise-roles/.git/
      create  app
      create  app/assets/config/manifest.js
      create  app/assets/javascripts/application.js
      create  app/assets/javascripts/cable.js
      create  app/assets/stylesheets/application.css
      create  app/channels/application_cable/channel.rb
      create  app/channels/application_cable/connection.rb
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/jobs/application_job.rb
      create  app/mailers/application_mailer.rb
      create  app/models/application_record.rb
      create  app/views/layouts/application.html.erb
      create  app/views/layouts/mailer.html.erb
      create  app/views/layouts/mailer.text.erb
      create  app/assets/images/.keep
      create  app/assets/javascripts/channels
      create  app/assets/javascripts/channels/.keep
      create  app/controllers/concerns/.keep
      create  app/models/concerns/.keep
      create  bin
      create  bin/bundle
      create  bin/rails
      create  bin/rake
      create  bin/setup
      create  bin/update
      create  bin/yarn
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/secrets.yml
      create  config/cable.yml
      create  config/puma.rb
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/application_controller_renderer.rb
      create  config/initializers/assets.rb
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/cookies_serializer.rb
      create  config/initializers/cors.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/new_framework_defaults_5_1.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  lib
      create  lib/tasks
      create  lib/tasks/.keep
      create  lib/assets
      create  lib/assets/.keep
      create  log
      create  log/.keep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/apple-touch-icon-precomposed.png
      create  public/apple-touch-icon.png
      create  public/favicon.ico
      create  public/robots.txt
      create  test/fixtures
      create  test/fixtures/.keep
      create  test/fixtures/files
      create  test/fixtures/files/.keep
      create  test/controllers
      create  test/controllers/.keep
      create  test/mailers
      create  test/mailers/.keep
      create  test/models
      create  test/models/.keep
      create  test/helpers
      create  test/helpers/.keep
      create  test/integration
      create  test/integration/.keep
      create  test/test_helper.rb
      create  test/system
      create  test/system/.keep
      create  test/application_system_test_case.rb
      create  tmp
      create  tmp/.keep
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor
      create  vendor/.keep
      create  package.json
      remove  config/initializers/cors.rb
      remove  config/initializers/new_framework_defaults_5_1.rb
       apply  https://raw.github.com/RailsApps/rails-composer/master/composer
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/open-uri.rb:358:in `open_http': 404 Not Found (OpenURI::HTTPError)
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/open-uri.rb:736:in `buffer_open'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/open-uri.rb:211:in `block in open_loop'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/open-uri.rb:209:in `catch'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/open-uri.rb:209:in `open_loop'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/open-uri.rb:150:in `open_uri'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/open-uri.rb:716:in `open'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/open-uri.rb:34:in `open'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/actions.rb:220:in `apply'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.1.5/lib/rails/generators/app_base.rb:162:in `apply_rails_template'
        from (eval):1:in `apply_rails_template'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `block in invoke_all'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `each'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `map'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `invoke_all'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/group.rb:232:in `dispatch'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.1.5/lib/rails/commands/application/application_command.rb:24:in `perform'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.1.5/lib/rails/command/base.rb:63:in `perform'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.1.5/lib/rails/command.rb:44:in `invoke'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.1.5/lib/rails/cli.rb:16:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.1.5/exe/rails:9:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.2.0/bin/rails:23:in `load'
        from C:/RailsInstaller/Ruby2.2.0/bin/rails:23:in `<main>'
4

1 回答 1

2

您的端点无法访问,请尝试:

rails new rails-devise-roles -m https://raw.githubusercontent.com/RailsApps/rails-composer/master/composer.rb

但如果这不起作用,只需从原始文件本地下载 ruby​​ 代码并指向本地 rb 文件。

在您的终端中:

curl -O https://raw.githubusercontent.com/RailsApps/rails-composer/master/composer.rb

rails new rails-devise-roles -m composer.rb
于 2018-03-20T14:01:57.657 回答