2011-10-28 55 views
0

我提前爲我的無知道歉,但是當我在終端運行耙分貝:創建:所有

"rake db:create:all" 

我有這個問題。

NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. 
Gem.source_index called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/shared_helpers.rb:3. 
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. 
Gem.source_index called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:162. 
NOTE: Gem::SourceIndex#each is deprecated with no replacement. It will be removed on or after 2011-11-01. 
Gem::SourceIndex#each called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:162. 
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. 
Gem.source_index called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/shared_helpers.rb:84. 
WARNING: This version of mysql2 (0.3.7) doesn't ship with the ActiveRecord adapter bundled anymore as it's now part of Rails 3.1 
WARNING: Please use the 0.2.x releases if you plan on using it in Rails <= 3.0.x 
WARNING: 'require 'rake/rdoctask'' is deprecated. Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead. 
    at /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rdoctask.rb 
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 
Couldn't create database for {"username"=>"root", "adapter"=>"mysql", "database"=>"testApp", "host"=>"localhost", "password"=>"mysql"}, charset: utf8, collation: utf8_unicode_ci 
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 
Couldn't create database for {"username"=>"root", "adapter"=>"mysql", "database"=>"testApp", "host"=>"localhost", "password"=>"mysql"}, charset: utf8, collation: utf8_unicode_ci 

我也跟着獅子座Shevtsov

我的第二個問題:當我bundle update它是這樣的:

NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. 
Gem.source_index called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/shared_helpers.rb:3. 
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. 
Gem.source_index called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:162. 
NOTE: Gem::SourceIndex#each is deprecated with no replacement. It will be removed on or after 2011-11-01. 
Gem::SourceIndex#each called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:162. 
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. 
Gem.source_index called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:162. 
NOTE: Gem::SourceIndex#each is deprecated with no replacement. It will be removed on or after 2011-11-01. 
Gem::SourceIndex#each called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:162. 
Fetching source index for http://rubygems.org/ 
Enter your password to install the bundled RubyGems to your system: 
/usr/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:122:in `initialize': no metadata found in /usr/lib/ruby/gems/1.8/cache/rake-0.9.2.2.gem (Gem::Package::FormatError) 
    from /usr/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:20:in `new' 
    from /usr/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:20:in `open' 
    from /usr/lib/ruby/site_ruby/1.8/rubygems/package.rb:44:in `open' 
    from /usr/lib/ruby/site_ruby/1.8/rubygems/format.rb:62:in `from_io' 
    from /usr/lib/ruby/site_ruby/1.8/rubygems/format.rb:46:in `from_file_by_path' 
    from /usr/lib/ruby/1.8/open-uri.rb:32:in `open_uri_original_open' 
    from /usr/lib/ruby/1.8/open-uri.rb:32:in `open' 
    from /usr/lib/ruby/site_ruby/1.8/rubygems/format.rb:45:in `from_file_by_path' 
    from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:73:in `fetch' 
    from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:45:in `run' 
    from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each' 
    from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each' 
    from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:44:in `run' 
    from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:8:in `install' 
    from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/cli.rb:226:in `install' 
    from /usr/lib/ruby/gems/1.8/gems/thor-0.14.6/lib/thor/task.rb:22:in `send' 
    from /usr/lib/ruby/gems/1.8/gems/thor-0.14.6/lib/thor/task.rb:22:in `run' 
    from /usr/lib/ruby/gems/1.8/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task' 
    from /usr/lib/ruby/gems/1.8/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch' 
    from /usr/lib/ruby/gems/1.8/gems/thor-0.14.6/lib/thor/base.rb:389:in `start' 
    from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/bin/bundle:13 
    from /usr/bin/bundle:19:in `load' 
    from /usr/bin/bundle:19' 

我似乎無法無差錯運行包更新。我使用Fedora 15和Mysql 5.5運行我的機器。

再次感謝,我爲我的無知道歉;我是Rails的新手。

在此先感謝! :)

+0

您使用的是哪種版本的導軌? – Cygnusx1

+0

即時使用3.0.5 rails – Led

回答

3

看起來你應該在你的Gemfile限制mysql2版本:

gem 'mysql2', '~>0.2.0' 

[編輯] ...然後做一個bundle install當然

+0

恩對不起,我的無知我試圖按照你的建議,並帶領莫到這個對不起,我剛剛在紅寶石世界 在/usr/lib/ruby/gems/1.8/cache/找不到元數據rake-0.9.2.2.gem(Gem :: Package :: FormatError) – Led

0

的,正如我們所看到的日誌,我想你已經指定mysql作爲你的config/database.yml中的適配器

更改爲:

adapter: mysql2 

編輯:

你FormatError,我知道我必須使用:

bundle exec rake db:<command> 

現在爲了執行耙,你可以試試這個?

編輯2:

那麼,我建議你使用RVM設置使用Ruby 1.9.2項目。 Read RVM Doc一個簡單的指導如何做到這一點。

然後做一個捆綁安裝

之後,你一定要做:

ruby -v 

應該是1.9.2

然後重試分貝:創建這樣的:

bundle exec rake db:create:all 

希望它終於有效。 ;-)

+0

謝謝,我沒有注意到,我之前嘗試過leonid的消化吸收並且讓我看到了這個 沒有在/usr/lib/ruby/gems/1.8/中找到元數據cache/rake-0.9.2.2.gem(Gem :: Package :: FormatError) 對不起,我只是在紅寶石世界新的 – Led

+0

沒有問題,我有一天新的,保持它,你會喜歡這個框架,一旦你得到在這些開始的問題上。 – Cygnusx1

+0

感謝任何想法如何解決這個問題? 在/usr/lib/ruby/gems/1.8/cache/rake-0.9.2.2.gem(Gem :: Package :: FormatError)找不到元數據 – Led

0

爲了擺脫RubyGems的廢棄警告更新到最新版本RubyGems的和運行

gem pristine --all --no-extensions

至於你的mysql錯誤。確保你打開了MySQL服務/守護進程並確保你的database.yml配置文件是正確的。

相關問題