ruby on rails 的使用過程當中,遇到的錯誤及解決辦法

一、/data/drolay11/lcb_saas/tmp/build-147274463612855/vendor/bundle/ruby/2.1.0/bin/rake: symbol lookup error: /data/drolay11/lcb_saas/tmp/build-147274463612855/vendor/bundle/ruby/2.1.0/gems/mysql2-0.3.17/lib/mysql2/mysql2.so: undefined symbol: mysql_get_client_infomysql

這種問題多是ruby版本衝突引發的。刪除全部的ruby,從新安裝。mysql2用0.3.13的。nginx

 

二、.rvm/gems/ruby-2.1.5/bin/bundle:22:in `<main>': undefined method `activate_bin_path' for Gem:Module (NoMethodError)sql

gem install rubygems-update
update_rubygems
or

ruby --disable-gems -S update_rubygemsruby

 

三、NoMethodError: undefined method `spec' for nil:NilClassapp

An error occurred while installing carrierwave (0.11.0), and Bundler cannot continue.post

Make sure that `gem install carrierwave -v '0.11.0'` succeeds before bundling.gem ui

gem uninstall bundlercode

gem install bundler  就是安裝新版的bundlerget

 

四、.rvm/wrappers/ruby-2.1.5/rake nginx:clean nginx RELEASE=yesit

rake aborted!
LoadError: cannot load such file -- rubygems/builder

gem install passenger --version 4.0.0.rc6

 

 五、%u轉化爲漢字的問題:

如:迷戀你娘  %u8FF7%u604B%u4F60%u5A18
 

s = "%u8FF7%u604B%u4F60%u5A18"

b = s.split("%u")-[""]
b.map{|t| [t.to_i(16)].pack("U")}.join

 

六、Bundler::GemspecError: Could not read gem at /XXX-1.8.2.gem. It may be corrupted.

刪除cache裏的文件,從新bundle install

 

七、國際化時若是有目錄,配置文件的寫法也是用目錄形式,好比: admin/user:

相關文章
相關標籤/搜索