Rails LoadError when trying to start server - ruby-on-rails

I'm following SaaS from edX and I'm trying to run my rails server that I created using
rails s
and it keeps throwing a load error for
gem/ruby-1.9.3-p448/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so:
undefined symbol: ruby_current_thread
I'm not quite sure what I can do to fix this, or what other info would be required to help me solve this. I'm sorry for such a vague post but ruby on rails is rather new to me and I'm not sure why its throwing this
ive tried
gem install rails
and i get a permissions error
*Edit 1
Gemfile The debug19 is what i was told to put in per my instructions from edX 169.1
source 'https://rubygems.org'
gem 'rails', '3.2.14'
# 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.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
gem 'haml'
# To use debugger
# gem 'debugger'
group :development ,:test do
gem 'ruby-debug19' , :require => 'ruby-debug'
end

I don't know enough about your environment to give an exact answer, but you can try removing ruby-debug-base19 and ruby-debug from your Gemfile. You can also see if it's being installed by another gem by looking for references to them in your Gemfile.lock. If they are dependencies, remove the gems they depend on as well.

Related

ZenTest 4.9.3 shows as invalid gemspec

I keep getting this error when trying to run ZenTest
Invalid gemspec in [/usr/local/rvm/gems/ruby-1.9.3-p194/specifications/ZenTest-4.9.3.gemspec]: Illformed requirement ["< 2.1, >= 1.8"].
I have tried removing the ZenTest 4.9.3 and gem instal ZenTest 4.8.3 but that version cannot be found in any repositories so it automatically installs ZenTest 4.9.3 which keeps having an error and hence I cant run spork or autotest. Is there any way around this? Thanks!
Here is my gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.11'
gem 'spork'
gem 'rspec-core'
gem 'autotest', '4.4.6'
gem 'autotest-rails', '4.1.2'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development, :test do
gem 'sqlite3'
gem 'rspec-rails'
gem 'webrat'
gem 'capybara'
gem 'Zentest', '4.8.3'
end
group :production do
gem 'pg'
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
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
I had the same problem. After digging, I found the solution. The problem is most likely to be with the version of RubyGems installed in your system. (It would be <1.8.25)
Till that version, RubyGems didn't roundtrip gemspecs properly and thus couldn't parse "< 2.1, >= 1.8" correctly.
So, go through these steps:
gem uninstall ZenTest
gem update --system
gem install ZenTest
The problem should get solved and you should no longer receive the warnings.

compass install bootstrap -> NoMethodError on line ["32"] ... sass-rails-3.2.6/lib/sass/rails/helpers.rb: undefined method `[]' for nil:NilClass

After running this command
compass install bootstrap
I get this message:
identical sass/styles.scss
...
identical javascripts/bootstrap-typeahead.js
NoMethodError on line ["32"] of /Users/xxx/.rvm/gems/ruby-1.9.3-p327#favy/gems/sass-rails-3.2.6/lib/sass/rails/helpers.rb: undefined method `[]' for nil:NilClass
Run with --trace to see the full backtrace
in /Users/xxx/.rvm/gems/ruby-1.9.3-p327#favy/gems/sass-rails-3.2.6/lib/sass/rails/helpers.rb
31 def resolver
32 options[:custom][:resolver]
33 end
I tried a workaround -> https://gist.github.com/castus/4044953
def resolver
if ::Rails::env == "production"
options[:custom][:resolver]
else
Resolver.new(CompassRails.context)
end
end
& still no luck :)
I have this stuff in my config/compass.rb
require 'bootstrap-sass'
And my Gemfile
source 'http://rubygems.org'
gem "paperclip"
gem 'bootstrap-sass', '~> 2.3.1.0'
gem 'compass-rails'
gem 'bootswatch-rails'
gem 'gmaps4rails'
gem 'rails', '3.2.13'
gem 'activerecord-postgresql-adapter'
gem 'devise'
gem 'sass-rails', '~> 3.2.3'
gem "haml"
gem "haml-rails"
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
# 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
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
You don't need "Compass" at all if you are using Rails and Bootstrap-sass. Compass is for sites not using Rails.
Here are steps to install and bootstrap-sass
Add it to Gemfile and bundle install
Rename application.css to application.css.scss
Remove all comments in application.css.scss, make it blank
Add #import bootstrap
You are done! Treat it as normal css file and use #import to do whatever you like. But no more require in comment!

Gemfile Syntax Error

I get the following error: Gemfile Syntax Error.
Here is my code:
source 'https://rubygems.org'
gem 'rails', '3.2.1'
gem 'devise'
# Bundle bootstrap gems
group :development do
gem 'thin'
# 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.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
You're missing an end for the do in group :development. Add an end statement on the line after gem 'sqlite3'.
You can run ruby -c Gemfile to check the syntax (it's regular Ruby code), and it'll give you an idea of where the error lies.
It looks like you are missing a end after the development group.
I encountered the error several times, but I didn't touch the file generated by rails and ruby -c Gemfile says syntax is Ok. In my case, if rails command can not be found, Gemfile syntax error might be reported.
I use brew+rbenv+ruby 2.0+rails 4 and I use the following commands to get things back to normal.
# new commands in brew-installed ruby might not be linked automatically
brew unlink ruby && brew link ruby
# fix "gem" itself
sudo gem update --system
# after installing executable with rbenv, you need rehash
rbenv rehash

Mercury: SyntaxError: cannot return a value from a constructor

Working on a fresh install of rails 3.2.8 and getting an error when compiling after adding Mercury:
SyntaxError: cannot return a value from a constructor: "this.element" in class Button
(in /home/*********/**************/vendor/bundle/ruby/1.8/bundler/gems/mercury-0c048033cd79/app/assets/javascripts/mercury/toolbar.button.js.coffee)
I've successfully installed Mercury using Rails 3.2.3, but haven't been able to figure why this wouldn't be working.
Any ideas?
source 'https://rubygems.org'
gem 'rails', '3.2.8'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'bootstrap-sass'
gem 'simple_form'
gem 'json'
gem 'ckeditor'
gem 'mercury-rails', :git => 'https://github.com/jejacks0n/mercury.git'
gem 'jquery-rails'
# gem 'jquery-ui-rails'
gem "paperclip", "~> 2.7"
# To use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'
# 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', '0.10.2', :platforms => :ruby
gem 'libv8', '~> 3.3.10'
gem 'execjs'
gem 'uglifier', '>= 1.0.3'
end
https://github.com/jejacks0n/mercury/issues/349
i guess you need to lock into coffeescript 1.4.0
this fixed my issue.
Apparently, there is a fix, which is in the github repo, but not on rubygems, yet. If you don't want to downgrade coffee-script, just specify the repository in the Gemfile:
# Gemfile
# ...
gem 'mercury-rails', git: 'git://github.com/jejacks0n/mercury'
and run bundle update mercury-rails, afterwards. This fixed this problem for me without the need to downgrade coffee-script.
Here's what you actually need to type into your gemfile:
gem 'coffee-script-source', '1.4.0'

Rails: undefined method 'paginates_per'

I'm installing a gem called Carrier https://github.com/stanislaw/carrier/blob/master/Gemfile into a Rails 3.2.1 app. It uses Kaminari and when I did bundle install after adding gem "carrier" to my Gemfile, it showed that I was using kaminari
Using kaminari (0.13.0)
However, when I tried to rake db:migrate, I got this error
rake aborted
undefined method `paginates_per' for Carrier::Chain(Table doesn't exist):Class
Can anyone suggest a fix for this? I've copied the gemfile from the Carrier gem below and the Gemfile for my own app below that
(Carrier gem Gemfile)
source "http://rubygems.org"
gem 'require_all'
gem 'kaminari'
gem 'unread'
gem 'sugar-high'
gem 'sweetloader'
group :development, :test do
gem 'rails', '~> 3.1.0'
gem 'unicorn'
gem 'mysql2'
gem 'devise'
gem 'rake-kit'
gem 'cutter'
gem "jeweler", ">= 1.6.4"
gem "rspec-rails", '>= 2.5'
end
group :test do
gem 'capybara'
gem 'factory_girl'
gem 'spork'
gem "launchy"
gem 'shoulda'
end
Gemfile for my starter app
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'pg'
gem 'devise'
gem 'carrier'
# 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'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
Update These are the migrations it installed when I ran install:migrations
rake carrier:install:migrations
Copied migration 20120229055640_create_messages.carrier.rb from carrier
Copied migration 20120229055641_create_chains.carrier.rb from carrier
Update
I tried to reinstall it again on another git branch it this time I got a slightly different error when I ran rake db:migrate
rake aborted!
undefined method `acts_as_readable' for Carrier::Message(Table doesn't exist):Class
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
You appear to be missing some database backing for what Carrier is trying to do. From the Carrier readme, it looks like you need to run rake carrier:install:migrations before running db:migrate. Have you done that?

Resources