5

I am learning Ruby on Rails and I followed the installation of RVM and Rails from Ryan Bigg's blog and the Agile Wed Development book. This has worked previously on my PC at home, but at work it gives me the error:

depot$ rails -v
Could not find gem 'sqlite3 (>= 0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.

I am trying to generate a scaffold but this is what i get:

depot$ rails generate scaffold Product \ title:string description:text image_url:text price:decimal
Could not find gem 'sqlite3 (>= 0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.

I have sqlite3 installed, RVM 1.9.2-p320, and running on Ubuntu 11.04.

Any ideas what can be causing this and how to fix it?

6
  • Well, did you run bundle install like it told you two (twice)? If so what happened? Commented Nov 16, 2012 at 11:58
  • Yes, I have tried that but give me an error: Could not locate Gemfile Commented Nov 16, 2012 at 12:03
  • What version of Rails is your app? Did you run bundle install in your app directory or elsewhere? What is the output of rvm current & which rails? Commented Nov 16, 2012 at 12:05
  • Okay I did bundle install from the app directory now, and it installed. rvm current is ruby-1.9.2-p320, and which rails points to ....rvm/gems/ruby-1.9.2-p320/bin/rails Commented Nov 16, 2012 at 12:07
  • The bundle install from within the app directory worked and I just created the scaffold. But what happened here? On my PC at home I did the exact same thing as I did here, but I didn't get that error. Commented Nov 16, 2012 at 12:11

4 Answers 4

7

Run

bundle install

in your Rails app's directory just like both error messages instruct you to.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, but I am pretty sure I did this and it gave me an error. Sorr if it is a stupid question, but why do you run it from inside the app directory? And what could cause that I did not have to do this previously?
You must run it from inside your app directory because it uses the Gemfile, which is only (and should only be) in your app directory. You would have always had to do this previously, you may just have happened to be in your app directory last time.
Oh I understand now. Yeah might just not have noticed it. I am new to coding, and this is the first time (started about a week ago) I am looking at Ubuntu and Ruby on Rails. Still getting around and figuring everything out. Thank you for the help.
4

i had the same issue you could try to run sudo apt-get install libsqlite3-dev and bundle install in the app directory.

Comments

0

You need to run it from your app directory so it can find the Gemfile to know which gems it needs to install from the Gemfile.

Comments

-1

Yes. I was also having the same problem when I started with rails, then when writing "rails new " I got this problem of sqlite3 . This appears due to the reason that "bundle install" is not executed. When we try to 'bundle install' then it will show some gemfile missing error. This happens due to the reason that we haven't changed the directory to that folder where we are using the rails application. So for solving this problem follow these steps :

  1. type 'rails new app' // instead of app you can type any name you want.
  2. now a folder named app will be created in your home.
  3. now start new terminal.
  4. type 'cd app'
  5. now you can continue your work, and you will not face any such problem.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.