Problem launching Rails server - ruby-on-rails

Just started up in Rails. I'm on windows vista, installed the latest build of ruby from http://rubyinstaller.org/ and everything went well.
ruby -v
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
I run:
gem update --system
gem sources -a http://gemcutter.org
gem install rails
No errors reported.
rails --v
Rails 3.1.0
after this I created a folder for my Rails project and I created a new Rails app inside as follows:
rails new test
cd test
bundle install
(again no error reported)
But when I run rails server I get this error:
rails server
←[31mCould not find rails-3.1.0 in any of the sources←[
←[33mRun `bundle install` to install missing gems.←[0m
I try to run bundle again but no success again... After this, if I type again rails -v I get the same error as before. I have to close the windows console and reopen for rails -v to start working again!!
Has anyone experience this?! Can you help?
Thanks!!!
As requested the gemfile content is:
source 'http://rubygems.org'
gem 'rails', '3.1.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
gem 'jquery-rails'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
group :test do
# Pretty printed test output
gem 'turn', :require => false
end
bundle install result:
Fetching source index for http://rubygems.org/
Using rake (0.9.2)
Using multi_json (1.0.3)
Using activesupport (3.1.0)
Using bcrypt-ruby (3.0.0)
Using builder (3.0.0)
Using i18n (0.6.0)
Using activemodel (3.1.0)
Using erubis (2.7.0)
Using rack (1.3.2)
Using rack-cache (1.0.3)
Using rack-mount (0.8.3)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.0.0)
Using actionpack (3.1.0)
Using mime-types (1.16)
Using polyglot (0.3.2)
Using treetop (1.4.10)
Using mail (2.3.0)
Using actionmailer (3.1.0)
Using arel (2.2.1)
Using tzinfo (0.3.29)
Using activerecord (3.1.0)
Using activeresource (3.1.0)
Using ansi (1.3.0)
Using bundler (1.0.18)
Using coffee-script-source (1.1.2)
Using execjs (1.2.4)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using rdoc (3.9.4)
Using thor (0.14.6)
Using railties (3.1.0)
Using coffee-rails (3.1.0)
Using jquery-rails (1.0.13)
Installing rails (3.1.0)
Using sass (3.1.7)
Using sass-rails (3.1.0)
Using sqlite3 (1.3.4)
Using turn (0.8.2)
Using uglifier (1.0.2)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem
is installed.

try bundle exec rails server instead of rails server

Related

Trying to install gems needed to run the twitter Bootstrap gem - getting error while running bundle

I have a regular Rails 4 app for which Im trying to incorporate the twitter bootstrap framework.
The relevant parts of my gemfile looks like this:
#Gems used only for assets and not required in production environments by default
group :assets do
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem "therubyracer", :require => 'v8'
gem "less-rails", "~> 2.4.2"
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
gem "twitter-bootstrap-rails", "~> 2.2.8"
end
When I run the bundle command on terminal I get this error:
> bundle
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.0)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using annotate (2.5.0)
Using bundler (1.3.5)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server
certificate B: certificate verify failed
(https://s3.amazonaws.com/production.s3.rubygems.org/gems/commonjs-0.2.7.gem)
An error occurred while installing commonjs (0.2.7), and Bundler cannot continue.
Make sure that `gem install commonjs -v '0.2.7'` succeeds before bundling.
What am I doing wrong? Thanks
It's common issue on Mac (for me exactly). Try to update openssl:
brew update
brew install openssl
Sometimes it can also be useful to update symlinks and certificates:
brew link openssl --force
brew install curl-ca-bundle
If this doesn't help and you are using RVM try to update rvm's certificates:
rvm osx-ssl-certs update all
Hope this helps!

simple Heroku + Rails 4 app crashing

I am at the end of Chapter 2 of Hartl's Rails Tutorial the app works locally but I can't get it to deploy.
http://quiet-ocean-3277.herokuapp.com/
$ git push heroku master
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 253 bytes, done.
Total 2 (delta 1), reused 0 (delta 0)
-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-1.9.3
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
Using rake (10.1.0)
Using i18n (0.6.4)
Using minitest (4.7.5)
Using multi_json (1.7.7)
Using atomic (1.1.10)
Using thread_safe (0.1.0)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.23)
Using polyglot (0.3.3)
Using treetop (1.4.14)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using coffee-script-source (1.6.3)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.0.2)
Using jquery-rails (2.2.1)
Using json (1.8.0)
Using pg (0.15.1)
Using bundler (1.3.2)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rails_serve_static_assets (0.0.1)
Using rails_stdout_logging (0.0.1)
Using rails_12factor (0.0.2)
Using rdoc (3.12.2)
Using sass (3.2.9)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.1.1)
Using uglifier (2.1.1)
Your bundle is complete! It was installed into ./vendor/bundle
Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
Asset precompilation completed (7.52s)
Cleaning assets
-----> WARNINGS:
You have not declared a Ruby version in your Gemfile.
To set your Ruby version add this line to your Gemfile:
ruby '1.9.3'
# See https://devcenter.heroku.com/articles/ruby-versions for more information."
-----> Discovering process types
Procfile declares types -> (none)
Default types for Ruby/Rails -> console, rake, web, worker
-----> Compiled slug size: 20.0MB
-----> Launching... done, v8
http://quiet-ocean-3277.herokuapp.com deployed to Heroku
To git#heroku.com:quiet-ocean-3277.git
2d25f33..322b9e4 master -> master
All looks good except the app crashes. In the logs:
2013-07-17T23:56:21.430674+00:00 heroku[web.1]: State changed from starting to crashed
2013-07-18T00:00:36.148404+00:00 heroku[web.1]: State changed from crashed to starting
2013-07-18T00:00:39.933663+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 40617 -e $RAILS_ENV`
2013-07-18T00:00:41.477904+00:00 app[web.1]: /usr/bin/env: ruby1.9.1: No such file or directory
2013-07-18T00:00:42.674144+00:00 heroku[web.1]: Process exited with status 127
Why is it calling Ruby 1.9.1 and crashing ? Here's the gemfile:
source 'https://rubygems.org'
#ruby '1.9.3'
#ruby-gemset=railstutorial_rails_4_0
gem 'rails', '4.0.0'
group :development do
gem 'sqlite3', '1.3.7'
end
gem 'sass-rails', '4.0.0'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.0'
gem 'jquery-rails', '2.2.1'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end
I had same problem. I solved it by repacement "#!/usr/bin/env ruby1.9.1" => "#!/usr/bin/env ruby" in 3 files:
bin/bundle
bin/rails
bin/rake
Short answer, you need to specify the ruby version in the Gemfile. It looks like you have it commented out. Heroku uses ruby v1.9.1 by default
This answer links to a gist with steps you can follow to make sure your local and heroku set up are correct.
I would recommend placing:
ruby '2.0.0'
in your Gemfile towards the top. Ruby 2.0.0 contains many changes that increase performance and it works better with Rails 4.

Calendar on RoR (FullCalendar) not working after gem updates

FullCalendar stopped working after I upgraded some gems. I needed to add 'google-api-client' to the Gemfile and the Bundle Install process gave me the following message:
itsjustme#rubberroom:~/Projects/FunnyFarm$ bundle
Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/..
Bundler could not find compatible versions for gem "faraday":
In snapshot (Gemfile.lock):
faraday (0.8.0)
In Gemfile:
google-api-client (>= 0.5.0) ruby depends on
faraday (~> 0.8.1) ruby
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
Following instructions, I issued a Bundle Update. This was the result:
itsjustme#rubberroom:~/Projects/FunnyFarm$ bundle update
Fetching gem metadata from https://rubygems.org/.....
Error Bundler::HTTPError during request to dependency API
Fetching full source index from https://rubygems.org/
Using rake (10.0.2)
Using i18n (0.6.1)
Using multi_json (1.3.7)
Using activesupport (3.2.3)
Using builder (3.0.4)
Using activemodel (3.2.3)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.3)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.4.4)
Using actionmailer (3.2.3)
Using arel (3.0.2)
Using tzinfo (0.3.35)
Using activerecord (3.2.3)
Using activeresource (3.2.3)
Installing addressable (2.3.2)
Installing extlib (0.9.15)
Installing autoparse (0.3.2)
Using bcrypt-ruby (3.0.1)
Using bundler (1.2.2)
Using coffee-script-source (1.4.0)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.7.5)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.2.3)
Using coffee-rails (3.2.2)
Using multipart-post (1.1.5)
Using faraday (0.8.4)
Using jwt (0.1.5)
Installing launchy (2.1.2)
Installing signet (0.4.3)
Installing uuidtools (2.1.3)
Installing google-api-client (0.5.0)
Using haml (3.1.7)
Using httpauth (0.2.0)
Using jquery-rails (2.1.3)
Using libv8 (3.3.10.4)
Using mobilepronto (0.3.2)
Using mysql2 (0.3.11)
Using oauth (0.4.7)
Using oauth2 (0.6.1)
Using rails (3.2.3)
Using sass (3.2.3)
Using sass-rails (3.2.5)
Using sorcery (0.7.13)
Using sqlite3 (1.3.6)
Using therubyracer (0.10.2)
Using uglifier (1.3.0)
Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem
is installed.
Neither CSS nor jQuery files were modified and, being new to RoR, I have no idea where to start looking for a solution.
Screenshots
This is a screenshot taken before the update:
http://pic.twitter.com/85gUGSg3
This one, after the update:
http://pic.twitter.com/rYvIhsbe
Files
The view is too simple to make a difference. But here it is, anyway (show.html.haml):
%h4 Agenda dos Médicos
#calendar
Similarly, the controller is almost empty. It just points to the view.
class WorkSchedsController < ApplicationController
before_filter :require_login
def show
end
end
The magic of it all happens thanks to fullcalendar.js, configured as follows:
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
eventSources: [
// Dr. John Doe
{
url: 'https://www.google.com/calendar/feeds/userthis%40gmail.com/private-blah/basic',
color: 'dodgerblue'
},
// Dr. Jane Doe
{
url: 'https://www.google.com/calendar/feeds/userthat%40gmail.com/private-blah/basic',
color: 'brown'
},
// Code abbreviated
{
...
}
]
});
});
For the sake of completeness, this is the Gemfile, before the adding 'fullcalendar-rails' (as suggested by Mr. Durrant):
source 'https://rubygems.org'
gem 'rails', '3.2.3'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'sorcery'
gem 'mobilepronto'
gem 'execjs'
gem 'therubyracer'
gem 'mysql2'
gem 'haml'
gem 'sass'
# 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'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
Seems the table which sets the calendar has been flattened.
Can anyone help? Give some pointers or something?
What I see on your screenshots , it reminds me of the nightmare I had in the hot summer days . I have added a class in the .css.scss file , but forgot to close it (one little '}'). No matter I've tried it was a pain and sorrow in various tempos .
In your case I would focus in searching for inconsistent stylesheet , related with the tag "tbody" . It seems all the other css and js are OK . Keep us updated , sir .

gem not installing

Ok i keep getting this error
Could not find tzinfo-0.3.24 in any of the sources (Bundler::GemNotFound)
I am using rvm and i just created a gemset and i have this
gem list
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.3)
actionpack (3.0.3)
activemodel (3.0.3)
activerecord (3.0.3)
activeresource (3.0.3)
activesupport (3.0.3)
arel (2.0.7)
bcrypt-ruby (2.1.4)
builder (2.1.2)
bundler (1.0.7)
devise (1.1.5)
erubis (2.6.6)
i18n (0.5.0)
mail (2.2.14)
mime-types (1.16)
mysql (2.8.1)
paperclip (2.3.8)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
rack-test (0.5.7)
rails (3.0.3)
railties (3.0.3)
rake (0.8.7)
riddle (1.2.2)
thinking-sphinx (2.0.0)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.24)
warden (1.0.3)
will_paginate (3.0.pre2)
and my Gemfile is
source 'http://rubygems.org'
gem 'rails', '3.0.3'
gem 'mysql'
gem 'devise'
gem 'thinking-sphinx', '2.0.0', :require => 'thinking_sphinx'
gem "paperclip", "~> 2.3"
gem "will_paginate", "~> 3.0.pre2"
any ideas...it was working fine till today
Try including tzinfo-0.3.24 in your Gemfile and doing bundle exec with the command that gives you the error. Alternatively you could bundle install --development to get the Gems in the vendor folder. Let us know how you get on.
After DLL Hell we have Gem Hell. It looks like we have the same dependency hell in Ruby as in other communities. Welcome :-)
The gem tzinfo with the right version 0.3.24 seems to be missing, or it is not referenced correctly in your Gemfile. Check your Gemfile and your Gemfile.lock. The latter is useful to find out dependencies, and it should be updated if the Gemfile is changed (by running a bundle install).
If you have installed the gems locally, by using gem install --user-install gemname or bundle install --path ~/.gem, then you maybe have multiple gems in multiple locations. Check out the GEM PATHS by calling a gem env command from the command line.
And by the way, you seem to use Rails 3.0.x with the old mysql gem. The mysql2 gem is now the default in Rails 3. I would recommend to use the mysql2 gem instead by adding gem 'mysql2' to the GemFile and by using using the mysql2 adapter in your database.yml.

Can't find header files while running bundle install

I am just getting started learning rails.
I am building my first app using Ruby on Rails tutorial by Michael Hartl.
the book said to use this gem file.
source 'http://rubygems.org'
gem 'rails', '3.0.0.rc'
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
group :development do
gem 'rspec-rails', '2.0.0.beta.18'
end
group :test do
gem 'rspec', '2.0.0.beta.18'
end
However I get the following error when I run bundle install in the terminal:
Fetching source index for http://rubygems.org/
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.0.rc)
Using builder (2.1.2)
Using i18n (0.4.1)
Using activemodel (3.0.0.rc)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.4)
Using tzinfo (0.3.23)
Using actionpack (3.0.0.rc)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.8)
Using mail (2.2.6.1)
Using actionmailer (3.0.0.rc)
Using arel (0.4.0)
Using activerecord (3.0.0.rc)
Using activeresource (3.0.0.rc)
Using bundler (1.0.0)
Using diff-lcs (1.1.2)
Installing nokogiri (1.4.3.1) with native extensions /Library/Ruby/Site/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Paths suggest you are using a Mac, right? Maybe this answer solves your problem?
gem install mysql failure in Snow Leopard
Error looks the same. Accepted answer said that "Installing the Xcode that's bundled with the Snow Leopard fixed the problem."
Are you on Linux? Here is a list of common problems you might run into when installing stuff in Ubuntu Linux - http://rbjl.net/20-rubybuntu-2-troubleshooting-common-ruby-ubuntu-problems
I am on Linux and had to do the following to get nokogiri to install:
sudo apt-get install libxml2 libxml2-dev libxslt1-dev
gem install nokogiri (remember to use sudo if you are not using RVM)
Just FYI, Rails 3.0 was released on August 29. So you can use
gem 'rails', '3.0.0'

Resources