简体   繁体   中英

Unable to start Rails server

The issue is when I try to start server with rails server command after successfully created Rails app by running rails new myapp -d=mysql . However, I cant get the server to start and it gives me the following error:

Could not find gem 'mysql2 (~> 0.2.6, runtime)' in any of the gem sources listed in your Gemfile. Run `bundle install` to install missing gems.

Then I run bundle install but could not happen. I have installed:

  • Ruby 1.8.7
  • Rails 3.0.9 with mysql
  • RubyGems 1.8.7

I searched everywhere but nobody can solve my problem please help me with this issue as soon as possible. I am using Ubuntu 11.04. Thanks in advance.

i have reinstalled rails 4.2.4 using "gem install rails" command

and generated new project using rails new helloworld

"cd helloworld" and "rails server" would started my server.

If your bundle install is saying everything is installed, try prefixing your rails command with

bundle exec rails server <other args here>

That will make sure you run the server in the context of the bundle (as defined by your Gemfile). If that fixes the problem for you, then you can either keep running the server using that command, or figure out what's wrong with your environment (might be a path issue, or you might have multiple versions of ruby or bundler installed and things aren't getting installed where you think they are)

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