简体   繁体   中英

Error while starting server in ruby on rails

I am newbie to ruby on rails, here i am trying to install ruby on rails on 64 bit windows 7.

after running the command rails new app_name , i did cd app_name , and then rails server .but then am getting below error in command prompt.

how can i solve this error?

Could not find gem 'mysql2 (>= 0) x64-mingw32' in any of the gem sources listed
in your Gemfile or available on this machine.
Run `bundle install` to install missing gems.

If i run bundle install, i am getting

C:\Users\walnut>bundle install
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies.................
Using rake 10.4.2
Using i18n 0.7.0
Installing json 1.8.3 with native extensions

Gem::InstallError: The 'json' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.3'` succeeds before bundling.

Here you can try this solution :

  1. install rubyinstaller-1.9.3(i did try with latest version, but having some problem, just try using this installer first - download Here )
  2. install DevKit(download Here ) - Find the For use with Ruby 1.8.7 and 1.9.3: text inside those download page as we install ruby-1.9.3.
    • You can follow this for devKit installation or
    • follow this:
      • After download, run it to extract it somewhere (permanent). Then cd to it, run ruby dk.rb init and ruby dk.rb install to bind it to ruby installations in your path.
  3. After that, type gem install rails --no-ri --no-rdoc
  4. When finish all step above, you can create rails project at any place by using this command rails new yourProject
  5. If have an error something like "An error occurred while installing rake (*any version), and Bundler cannot continue." , refer this solution or follow this step :
    • Download AddTrustExternalCARoot-2048.pem , and put inside ruby installation folder, usually something like this path C:\\Ruby193\\lib\\ruby\\site_ruby\\1.9.1\\rubygems\\ssl_certs .
  6. Again, try type rails new yourProject (previous one failed).
  7. Finish, Usually the error about bundle install already gone. Have a luck my friend.
  8. Lastly, enter into yourProject dir, then run rails server .

I'm also having dificult time when first install on windows platform, hope this help. Please note that, if you are using other than default database using by rails(sqlite3) like mysql, postgresql, etc , then you need to install the right gem for that to work. just run gem install theRightGemForDatabase .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM