首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Can't link Localhost:3000 Ruby on Rails Page with Heroku -一个月Rails教程

Can't link Localhost:3000 Ruby on Rails Page with Heroku -一个月Rails教程
EN

Stack Overflow用户
提问于 2014-08-18 20:21:34
回答 1查看 122关注 0票数 0

因为我使用的是iOS Mavericks (该教程是2013年的),所以我无法从Mattan的一个月Rails教程中安装Ruby on Rails。我不知道我在做什么,我正在努力弄清楚我在做什么。我终于可以毫无错误地使用$ git push heroku master了,但是当我尝试使用Heroku提供的链接时,它并没有像预期的那样链接到我的本地主机:3000Ruby on Rails页面。

从那以后,我做出了改变,现在我担心我只会挖得更深。

代码语言:javascript
运行
AI代码解释
复制
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$ 
EN

回答 1

Stack Overflow用户

发布于 2014-08-18 20:45:14

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

我尝试使用Heroku提供的链接,它没有像预期的那样链接到我的本地主机:3000 Ruby on Rails页面

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

时为应用程序命名的任何名称

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

代码语言:javascript
运行
AI代码解释
复制
Sprockets::FileNotFound: couldn't find file 'turbolinks'

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

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25371428

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档