繁体   English   中英

无法将Localhost:3000 Ruby on Rails页面与Heroku链接-一个月的Rails教程

[英]Can't link Localhost:3000 Ruby on Rails Page with Heroku - One Month Rails Tutorial

由于无法使用iOS Mavericks(该教程来自2013年),因此无法从Mattan Griffel的“一个月Rails by Onean Rails”教程中安装Ruby on Rails。 我不知道自己在做什么,我正在尝试找出问题所在。 我终于可以在没有错误的情况下$ 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$ 

我无法从《 Mattan Griffel的一个月Rails教程》中安装Ruby on Rails,因为我使用的是iOS Mavericks(该教程来自2013年)

我试图使用从Heroku提供的链接,但它没有链接到我的localhost:3000 Ruby on Rails页面,就像它应该那样

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

最后,输出中的以下行提示了阻止git push heroku master命令成功的错误:

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

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM