问题
I'm fairly new to the Rails game; I'm a front-end dev teaching myself to program. I've built a web application and decided to use the RailsKit SaaS kit to handle my registrations and such. I'm having problems just getting the default app up and running, but I'm sure it's due to my lack of knowledge and I think it has to do with getting a mysql server set up (usually I use sqlite3, but that doesn't seem to work w/ this app either).
Here's the process and errors that I've come across, and I still can't even create a db or start the server...
Downloaded the app
Ran
bundle install
. Got the following error:Gem::InstallError: factory_girl requires Ruby version >= 1.9.2. An error occurred while installing factory_girl (4.1.0), and Bundler cannot continue. Make sure that `gem install factory_girl -v '4.1.0'` succeeds before bundling.
Found out I was running on Ruby version 1.8.7, so I added this to the Gemfile:
gem 'rake','1.9.2' and **updated my system** to 1.9.2
Ran
bundle install
and got the following error:An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling.
So I ran
gem install mysql2 -v '0.3.11
and got the following error:ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. /Users/trevanhetzel/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb checking for rb_thread_blocking_region()... yes checking for rb_wait_for_single_fd()... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lz... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lsocket... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lnsl... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lmygcc... no checking for mysql_query() in -lmysqlclient... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
So that's where I am. If this helps, after all the steps above, I tried to create a db by rake db:create
and got
Could not find gem 'mysql2 (>= 0) ruby' in the gems available on this machine.
So I'm guessing MySQL is not installed on my machine? Seems kinda odd cause I use MAMP all the time w/ a MySQL server.
Any help pointing me in the right direction would be great guys! I really appreciate it.
回答1:
bundle exec rake db:migrate
it sounds like.
回答2:
Before installing mysql2 gem you need to install mysql client and server in your system. So try this.
$sudo apt-get update
$sudo apt-get install mysql-server mysql-client
After this try to install gem mysql2
来源:https://stackoverflow.com/questions/13537722/getting-the-railskits-saas-app-up-and-running-w-a-mysql2-server