I developed a web in rails and it was working perfectly for months. Now I went to my web folder and started "rails server" but got the reply:
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
I really don't understand how rails could disappeared from my system, I am sure I haven't removed it. I was using rails 3.1 on a Mac. Any clues or suggestions?
Gemfile:
source 'rubygems.org';
gem 'rails', '3.1.0.rc5'
# gem 'rails', :git => 'git://github.com/rails/rails.git'
#group :test, :production do
# gem 'mysql', '5.1.58'
#end
#group :development do gem 'sqlite3'
#end
#gem install activerecord-mysql-adapter
gem 'json'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', "~> 3.1.0.rc"
gem 'coffee-rails', "~> 3.1.0.rc"
gem 'uglifier'
end
gem 'jquery-rails'
I have faced a similar problem.
I believe rails 3.1.0 is buggy, i myself tried my hands on it and reverted back to the stable version of rails i.e. anything but 3.1.0. It would have been better if you have installed RVM. With RVM you can have one or more rails version, in fact an entire gemset.
I myself have a global gemset and another gemset named rails1.
rvm gemset create gemset_name
Once you install the like of ruby and rails version you can set it default
rvm gemset default#gemset_name
I did this back then and it works fine on my end. More on RVM
Hope it helps.
Related
First, I'm bad at english, so I can't give a lot of details.. I've been trying to create a website using ruby on rails:
rails new azer
rails generate controller pages home
The last command doesn't work and there's an error occuring during generating:
/home/esteban/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/connection_specification.rb:177: in
'rescue in spec': Specified 'sqlite3' for database adapter, but the
gem is not loaded. Add gem 'sqlite3' to your Gemfile (and ensure its
version is at the minimum required by ActiveRecord).(Gem::LoadError)
So I opened my gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.10'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
...
...
I'm unsure what might be the error cause thus I don't know how to proceed.
Versions:
Ruby 2.4.4
Rails 4.2.10
SQLite3 1.4.1.
EDIT : Thanks for your help everyone, I appreciate it ! I just tried to reinstall rails and it worked
It seems version 1.4.x won't work with Rails 4. Install version 1.3.13 instead:
Unisntall version 1.4.1:
gem uninstall sqlite3 -v1.4.1
Modify Gemfile:
gem 'sqlite3', '~> 1.3.13'
And run bundle install.
I am working on a very old rails project. The gemfile is like this:
source 'http://rubygems.org'
gem 'rails', '2.3.17'
gem 'rake', '0.8.7'
gem 'rdoc', '3.6.1'
gem 'mysql', '2.8.1'
gem 'roo', '1.9.7'
gem 'rubyzip', '0.9.4'
gem 'pdf-writer', '1.1.8'
gem 'prawn', '0.12.0'
gem 'sendmail'
gem 'htmldoc', '0.2.3'
The ruby version is 1.8.7
What is the easy way to upgrade this rails app ? Can I just change the version of each gem to the latest one and expect it will work fine?
There is no easy way. Before You start upgrade you must add tests to be sure that application will still work after upgrade.
Then I recommend to change gem description to following syntax:
gem 'mysql', '~> 2.8.1' it tells bundler to update only last number of version of gem.
Then repeat following step
change rails version to next
bundle update rails
corrected conflicted gem version by hands
bundle update
I get the following error issued by Phusion when loading a web page:
There was an error while trying to load the gem 'compass-rails'.
Gem Load Error is: undefined method `has?' for Sass::Util:Module
Did you mean? hash
Hash
Backtrace for gem load error is:
/Volumes/Data/htdocs/zetcho/vendor/bundle/gems/compass-0.12.2/lib/compass/sass_extensions/functions/urls.rb:5:in `has?'
The code at the indicated location is:
module Compass::SassExtensions::Functions::Urls
def self.has?(base, instance_method)
Sass::Util.has?(:instance_method, base, instance_method)
end
My gem file contains:
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.2'
# Use mysql as the database for Active Record
gem 'mysql2', '~> 0.3.18'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Compass for stylesheets
gem 'compass-rails'
# Use the Compass extension susy
gem "sprockets"
gem 'susy'
I've just created the Ruby on Rails site using Rails 5.1.2 and ruby 2.3.1. I have a much older site that works fine with the gem. Did I miss a step in the overall install or is this a bug with compass-rails?
I got the same error when I tried to add a controller:
rails generate controller home index
After more digging around, I found a similar problem. I fixed this one by changing the gem file to:
gem 'compass-rails', github: 'Compass/compass-rails'
Then:
rm gemfile.lock
bundle
It seems that the issue can be found in compass-rails 2.0.0. The version 3.0.2 seems to fix this issues. So a possible solution is :
# Gemfile
gem 'compass-rails', '~> 3.0.2'
Then bundle update compass-rails
This avoids targeting the compass-rails git master branch in favor of an actual release.
I came here having the same issue with a grunt compiling issue trying to use Compass/Sass, if this might help someone, my issue was caused because I had an updated version of Sass (sass-3.7.4) that was higher that the max-version compatible with compass, I uninstalled sass:
gem uninstall sass
Which in turn uninstalled compass, and reinstalled compass letting it choose the right version, and problem solved.
gem install compass
I have been repeating this tutorial for weeks now:
https://www.digitalocean.com/community/articles/how-to-1-click-install-ruby-on-rails-on-ubuntu-12-10-with-digitalocean
Here are the specifics of my project:
I am using Mongoid with database.yml production set to my tested and working Droplet (DigitalOcean VPS) running MongoDB.
My gem file is here, I am new to Rails and am not quite sure if it's set up right, so I just moved them all to assets hoping Unicorn might serve these gems for me?
source 'https://rubygems.org'
gem 'rails', '3.2.14'
# 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 "therubyracer"
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
gem "twitter-bootstrap-rails"
gem 'redcarpet', '1.17.2'
gem 'uglifier', '>= 1.0.3'
gem "will_paginate_mongoid"
gem 'will_paginate', '~> 3.0.5'
gem 'will_paginate-bootstrap'
gem 'devise'
gem 'jquery-rails'
gem "mongoid", "~> 3.0.0"
end
Here's what I did:
I used DigitalOcean's 1 click installer. Then I used FileZilla to SFTP into the credentials they provided me with. I deleted all the files in /home/rails and put my new files in from my project. Then I executed bundle install, and restarted the unicorn service. In the tutorial I had seen I can track the log of unicorn, so I executed this: tail -f /home/unicorn/log/unicorn.log
Here is the output which concerns me:
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/bundler-1.3.5/lib/bundler/runtime.rb:33:in `block in setup': You have already activated rack 1.5.2, but your Gemfile requires rack 1.4.5. Using bundle exec may solve this. (Gem::LoadError)
I saw some other solutions to this, all failed. Here are the solutions I tried:
Deleting my Gemfile.lock, and re bundle installing it. Going into the file and removing where it said rack. Running bundle install --binstubs. Restarting the unicorn service with bundle exec before it. The error remains the same.
I've had many different errors before, but I feel this is the closest I have gotten. If someone could explain this to me (I'm new to Rails and would like a thorough explanation) and possibly help me fix the error that would be fantastic and end this frustration.
Just a wild guess
gem "rack", "~> 1.4.5"
May work for you, then of course bundle install afterwards.
This solves the problem:
gem uninstall rack -v 1.5.2
Possibly reload your Ubuntu installation from the DigitalOcean control panel, then try and install Ruby on Rails with Apache and Passenger?
Install RoR
Install Passenger (skip to passenger installation)
You will have errors when first creating your site with rails new as it will try and use SQL when it won't be installed, if you wish to use MongoDB
Here is a link to my screen cap. http://imgur.com/bbLud (SO doesn't allow noobs to post pics)
The problem.
Trying to bundle install and it keeps throwing the 'this version requires a different version of bundler' error. So I uninstall the current version, check my versions of bundler and it still appears. I go to uninstall it again and it tell me it doesn't exist. Can someone please lend a thought.
EDIT: Contents of Gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3-ruby', '1.0.0', :require => 'sqlite3'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end
Try to manually install bundler 1.0.0 using gem install bundler --version "1.0.0" and then run again bundle install.
UPDATE: Looking at the screenshot in the other answer it seems you already have bundler 1.0.0, BTW give it a try anyway. It seems the bundle command still points to the newer version, what do you get if you run bundle -v?
The error is at it says in the screenshot, you are using rails 3.0.1.
do uninstall without version
gem uninstall bundler
it will ask you which version you want to remove then remove it, select 1.3.1 to uninstall, do a bundle install again and if it still shows error post it back here.