[技巧]ERROR NoMethodError 和 Failed to build gem native extension

Haoxiang Li bio photo By Haoxiang Li

用Rails遇到的两个错误和解决办法,目前还是不尽其所以然,先记下。

1.用Webrick起Server的时候,刷新页面的时候遇到如下错误 ERROR NoMethodError: private method `gsub!’ called

参考http://www.ruby-forum.com/topic/206225

换mongrel做Web Server $./scripte/server mongrel 即可 需要安装mongrel $gem install mongrel

2.安装gem的时候遇到如下错误 ERROR: Failed to build gem native extension.

参考http://stackoverflow.com/questions/43778/sqlite3-ruby-gem-failed-to-build-gem-native-extension

环境是Ubuntu,需要安装ruby对应的dev包 $sudo apt-get install ruby1.8-dev