我教自己铁路.我是程序员但不是网络程序员.我在这里浏览Michael Hartl的书
它提到从一开始就开始部署应用程序是一个好主意.我同意.所以我在Heroku上获得了一个帐户并经历了设置等.然后创建了我的第一个应用程序,git和工程.然后按照Heroku网站上的所有说明进行操作.最后,我使用此命令将我的应用程序推送到Heroku:
git push heroku master
Run Code Online (Sandbox Code Playgroud)
这本书说在这个阶段可能会出现问题,因为我的机器上的应用程序使用的是sqlite3而Heroku需要postgresql.这本书建议改变我的应用程序的gem文件中的一行
gem 'sqlite3'
Run Code Online (Sandbox Code Playgroud)
至
gem 'sqlite3-ruby', :group => :development
Run Code Online (Sandbox Code Playgroud)
我尝试了然后运行bundle install然后尝试推送应用程序.没有运气我在我的控制台上收到此消息:
An error occured while installing sqlite3 (1.3.6), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)
!!无法通过Bundler安装gem.!!Heroku推送拒绝,无法编译Ruby/rails应用程序
所以我尝试了Heroku网站在这里建议的内容
改变我的宝石文件
由此:
gem 'sqlite3'
Run Code Online (Sandbox Code Playgroud)
对此:
gem 'pg'
Run Code Online (Sandbox Code Playgroud)
所以我尝试了这种方法然后运行'捆绑安装'.但这也不起作用.我在控制台上收到此消息:
Installing pg (0.13.2) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/AM/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building …Run Code Online (Sandbox Code Playgroud) 我正在启动一个Rails教程,告诉我在创建一个新的演示应用程序时编辑gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.3'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem :development do
gem 'sqlite3', '1.3.5'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.4'
gem 'coffee-rails', '3.2.2'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platform => :ruby
gem 'uglifier', '1.2.3'
end
gem 'jquery-rails', '2.0.0'
group :production do
gem 'pg', '0.12.2'
end
# To use ActiveModel has_secure_password …Run Code Online (Sandbox Code Playgroud) 我尝试启动我的localhost:3000 RoR应用程序.终端发生的事情:
[omrails]$rails s
Gemfile syntax error:
<<<<<<< HEAD
^
Run Code Online (Sandbox Code Playgroud)
我尝试在Google和Stackoverflow上搜索,但没有发现任何类似于我的问题.我假设ny Gemfile有问题,但我不知道究竟是什么.
我的Gemfile看起来像这样:
source 'https://rubygems.org'
gem 'rails', '3.2.8'
gem 'bootstrap-sass'
gem 'devise'
gem 'omniauth'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development do
gem 'sqlite3'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby …Run Code Online (Sandbox Code Playgroud) 我收到此错误
undefined method `default_max_wait_time=' for Capybara:Module (NoMethodError)
Run Code Online (Sandbox Code Playgroud)
当我尝试运行功能规范时,例如
$ rspec规范/功能/auto_policies/3_step_minimal_foundation_spec.rb
...
Performance on MRI may be improved with the concurrent-ruby-ext gem. Please see http://concurrent-ruby.com ...
/Users/mdurrant/eq/lynx/spec/support/capybara.rb:69:in `<top (required)>': undefined method `default_max_wait_time=' for Capybara:Module (NoMethodError)
Run Code Online (Sandbox Code Playgroud)
我已将 Gemfile 更新为最新的水豚 (2.4.4) 但我仍然收到此消息
如何解决这个问题?
在 Rails 控制台中,如何列出环境中已加载的 gem?
我正在使用 Gemfile 和 Rails 5。我四处搜索但没有结果。
尝试推送狂欢沙箱车来测试我要使用的扩展时,我遇到了这个错误.
我的Gemfile
gem 'spree_flexi_variants', :git=>'git@github.com:jsqu99/spree_flexi_variants.git', :branch => 'pre-deface-stable'
Run Code Online (Sandbox Code Playgroud)
heroku的输出推送:
julio@ubuntu:~/rails/sandboxcart $ git push heroku master
Counting objects: 502, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (475/475), done.
Writing objects: 100% (502/502), 2.63 MiB | 458 KiB/s, done.
Total 502 (delta 44), reused 0 (delta 0)
-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Detected Rails is not set to serve static_assets
Installing rails3_serve_static_assets... done
-----> Configure Rails 3 to disable x-sendfile
Installing rails3_disable_x_sendfile... done
----- …Run Code Online (Sandbox Code Playgroud) 我正在尝试在heroku上部署示例rails应用程序.创建一个非常基本的应用程序,添加一个git存储库,提交所有内容和"heroku创建"后,我将其推送到heroku.终端没有任何错误,但是当我用正确的地址打开浏览器时,我得到以下内容:
The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved.
Run Code Online (Sandbox Code Playgroud)
我搜索了三个小时并使用了heroku教程如何部署应用程序,但我无法弄清楚我做错了什么.这是我的Gemfile:
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.0.beta1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'json'
group :production do
gem 'pg'
gem 'rails', '4.0.0.beta1'
gem 'railties', '4.0.0.beta1'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
#gem 'sass-rails', '~> 3.2.3'
gem 'sass-rails', '~> 4.0.0.beta1' …Run Code Online (Sandbox Code Playgroud) 每当我跑:
rails -v
Run Code Online (Sandbox Code Playgroud)
我得到了结果
rails 3.2.13
Run Code Online (Sandbox Code Playgroud)
但我的gemfile如下:
gem 'rails', '~> 3.2.12'
gem 'rake' , '~> 10.0.4'
Run Code Online (Sandbox Code Playgroud)
我的gemfile.lock也有3.2.12,但出于某种原因,当我检查verison时,我已经安装了3.2.13.我想这就是我每次尝试运行服务器时都会收到错误的原因:
无法在任何来源中找到rake-10.0.4(Bundler :: GemNotFound)
任何人都可以告诉我为什么我运行rails 3.2.13?我希望运行3.2.12,因为我的技术人员告诉我2.13仍然存在问题,我需要坚持使用2.12.
也有人可以告诉我为什么我得到了rake错误,当我已经安装了rake gem并且它在我的gemfile中.
我是一个红宝石/铁杆新手.
这是我的gemfile:
source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0
gem 'rails', '4.0.0'
group :development do
gem 'sqlite3', '1.3.8'
gem 'ruby-debug-ide'
end
gem 'sass-rails', '4.0.0'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.0'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
gem 'wash_out', :git => 'git://github.com/inossidabile/wash_out.git'
gem 'haml'
gem "railties", "~> 4.0.0"
group :doc do
gem 'sdoc', '0.3.20', require: false
end
Run Code Online (Sandbox Code Playgroud)
在捆绑更新,我得到这个:
Bundler could not find compatible versions for gem "railties":
In Gemfile:
rails (= 4.0.0) ruby depends on
railties (= 4.0.0) ruby
sass-rails …Run Code Online (Sandbox Code Playgroud) 当我尝试开始潇洒时,我收到以下错误:
scheduler caught exception:
uninitialized constant Nokogiri
/Users/Adam/projects/ticker/jobs/sample.rb:2:in `block in <top (required)>'
Run Code Online (Sandbox Code Playgroud)
我的Gemfile是:
source 'https://rubygems.org'
gem 'nokogiri'
gem 'dashing'
Run Code Online (Sandbox Code Playgroud)
我的jobs文件夹包含一个文件夹sample.rb:
SCHEDULER.every '2s' do
oil_doc = Nokogiri::HTML(open("http://www.bloomberg.com/energy/"))
a = oil_doc.css("table.std_table_module").first
price = a.xpath("//td[3]").first.children.text
send_event('valuation', { current: price })
end
Run Code Online (Sandbox Code Playgroud)
我已经尝试添加 require 'open-uri'到Gemfile和sample.rb但它没有帮助!