【问题标题】:Can't link Localhost:3000 Ruby on Rails Page with Heroku - One Month Rails Tutorial无法将 Localhost:3000 Ruby on Rails 页面与 Heroku 链接 - 一个月 Rails 教程
【发布时间】:2014-10-11 20:18:11
【问题描述】:

我无法从 Mattan Griffel 的 One Month Rails 教程中安装 Ruby on Rails,因为我使用的是 iOS Mavericks(该教程来自 2013 年)。我不知道我在做什么,我正在努力弄清楚。我终于能够$ git push heroku master 没有错误,但是当我尝试使用 Heroku 提供的链接时,它并没有像预期的那样链接到我的 localhost:3000 Ruby on Rails 页面。

我已经做出了改变,现在我担心我只是把洞挖得更深了。

Demo:omrails Demo$ git push heroku master
Fetching repository, done.
Counting objects: 20, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (17/17), done.
Writing objects: 100% (17/17), 1.55 KiB | 0 bytes/s, done.
Total 17 (delta 11), reused 0 (delta 0)

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using 1.6.3
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
   Using minitest 4.7.5
   Using multi_json 1.10.1
   Using i18n 0.6.11
   Using thread_safe 0.3.4
   Using tzinfo 0.3.41
   Using builder 3.1.4
   Using erubis 2.7.0
   Using rake 10.3.2
   Using mime-types 1.25.1
   Using rack 1.5.2
   Using polyglot 0.3.5
   Using activerecord-deprecated_finders 1.0.3
   Using arel 4.0.2
   Using coffee-script-source 1.7.1
   Using execjs 2.2.1
   Using thor 0.19.1
   Using hike 1.2.3
   Using pg 0.17.1
   Using bundler 1.6.3
   Using json 1.8.1
   Using tilt 1.4.1
   Using activesupport 4.0.0
   Using coffee-script 2.3.0
   Using uglifier 2.5.3
   Using treetop 1.4.15
   Using activemodel 4.0.0
   Using mail 2.5.4
   Using rack-test 0.6.2
   Using sprockets 2.11.0
   Using activerecord 4.0.0
   Using actionpack 4.0.0
   Using actionmailer 4.0.0
   Using sprockets-rails 2.0.1
   Using railties 4.0.0
   Using jquery-rails 3.1.1
   Using coffee-rails 4.0.1
   Using rails 4.0.0
   Your bundle is complete!
   Gems in the groups development and test were not installed.
   It was installed into ./vendor/bundle
   Bundle completed (0.74s)
   Cleaning up the bundler cache.
   Removing turbolinks (2.2.2)
   Removing sass (3.2.19)
   Removing rdoc (4.1.1)
   Removing sass-rails (4.0.3)
   Removing jbuilder (1.5.3)
   Removing sdoc (0.4.1)
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
   Running: rake assets:precompile
   rake aborted!
   Sprockets::FileNotFound: couldn't find file 'turbolinks'
   (in /tmp/build_d6668242-8173-4c2f-b925-    
b40112014d6b/app/assets/javascripts/application.js:15)
   /tmp/build_d6668242-8173-4c2f-b925-   
   b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets- 
2.11.0/lib/sprockets/context.rb:106:in `resolve'
   /tmp/build_d6668242-8173-4c2f-b925-
b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-
2.11.0/lib/sprockets/context.rb:146:in `require_asset'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/directive_processor.rb:217:in `process_require_directive'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/directive_processor.rb:167:in `block in process_directives'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/directive_processor.rb:165:in `each'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/directive_processor.rb:165:in `process_directives'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/directive_processor.rb:99:in `evaluate'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:197:in `block in evaluate'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:194:in `each'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:194:in `evaluate'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/processed_asset.rb:12:in `initialize'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:374:in `new'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:374:in `block in build_asset'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:395:in `circular_call_protection'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:373:in `build_asset'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:94:in `block in build_asset'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/caching.rb:58:in `cache_asset'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:93:in `build_asset'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:287:in `find_asset'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:61:in `find_asset'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/bundled_asset.rb:37:in `init_with'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/asset.rb:24:in `from_hash'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/caching.rb:54:in `cache_asset'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:93:in `build_asset'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:287:in `find_asset'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:61:in `find_asset'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:211:in `block in find_asset'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:257:in `benchmark'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:210:in `find_asset'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:119:in `block in compile'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:118:in `each'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:118:in `compile'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:60:in `block (3 levels) in define'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/rake/sprocketstask.rb:146:in `with_logger'
   /tmp/build_d6668242-8173-4c2f-b925-b40112014d6b/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:59:in `block (2 levels) in define'
   Tasks: TOP => assets:precompile
   (See full trace by running task with --trace)
 !
 !     Precompiling assets failed.
 !

 !     Push rejected, failed to compile Ruby app

To git@heroku.com:powerful-fjord-2879.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:powerful-fjord-2879.git'
Demo:omrails Demo$ 

【问题讨论】:

    标签: ruby-on-rails ruby git heroku sublimetext2


    【解决方案1】:

    我无法从一个月的 Rails 安装 Ruby on Rails Mattan Griffel 教程,因为我使用的是 iOS Mavericks(教程 是从 2013 年开始的)

    我尝试使用 Heroku 提供的链接,但没有链接到 我的 localhost:3000 Ruby on Rails 页面应该是这样的

    • Heroku 不应该链接到您的本地主机。
    • 当您从计算机 (localhost) 部署代码时,您会将代码发送到另一台计算机(其他主机),您将能够通过该计算机的域名 (your-app.herokuapp.com) 访问您的应用程序)。如果您的部署成功,Heroku 将在终端的最后一行输出您可以在其中查看已部署应用程序的域,例如强大的-fjord.herokuapp.com。
    • 回顾一下:当您在计算机上运行rails server 时,Rails 将启动它的内置 Web 服务器并允许您在 localhost:3000 查看您的 Web 应用程序(这就像您在浏览器的地址栏中输入的 URL )。当您部署到 Heroku 时,它本身就是一台运行网络服务器的计算机,您可以在 Heroku 为您提供的域(或您稍后为其配置的域)查看它,通常类似于 powerful-fjord.herokuapp.com 或您在应用程序时命名的任何名称跑了heroku create my-app-name-here

    最后,阻止git push heroku master 命令成功的错误由输出中的这一行提示:

    Sprockets::FileNotFound: couldn't find file 'turbolinks'
    

    这意味着您的 Rails 应用缺少名为 turbolinks.js 的 javascript 文件。您可能需要将 turbolinks 添加到您的 Gemfile:gem 'turbolinks' 或从您的 application.js 中删除此行:*= require turbolinks。这样做,您的部署应该可以工作。

    就最新教程而言,上述网站 Railapps 是一个很好的来源。这是他们的教程:https://tutorials.railsapps.org/rails-tutorial

    【讨论】:

      猜你喜欢
      • 2015-02-22
      • 2015-04-23
      • 2013-06-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多