Could not find gem 'sqlite3 (>= 0) ruby'

2019-05-05 17:32发布

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?

4条回答
干净又极端
2楼-- · 2019-05-05 18:14

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

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-05-05 18:20

ya.. i was also having the same problem when we start with rails then while writing "rails new " we get this problem of sqlite3 . This appears due to the reason that we haven't wrote "bundle install" and install bundle. and when we try to write "bundle install" then it will show some gymfile 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. write "rails new app" // instead of app you can write any name you want.
  2. now a folder named app will be created in your home.
  3. now start new terminal.
  4. write "cd app"
  5. now you can continue your work, and you will not face any such problem.
查看更多
Melony?
4楼-- · 2019-05-05 18:26

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

查看更多
相关推荐>>
5楼-- · 2019-05-05 18:38

Run

bundle install

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

查看更多
登录 后发表回答