新checkout下来的项目,起server时遇到的各种问题,记录一下

阅读更多
说实在的,一遇到这种问题,我就头大,但是慢慢的我就觉得搞这些东西很有意思……
中间遇到了几个问题,关键是总结经验

一、memcache

$ ruby script/server

/usr/lib/ruby/1.8/memcache.rb:24:in `read': No such file or directory - /usr/lib/ruby/1.8/../VERSION.yml (Errno::ENOENT)
	from /usr/lib/ruby/1.8/memcache.rb:24
	from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
	from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'


使用下面这个命令,查看了以下这个包的安装情况
dpkg -L libmemcache-client-ruby1.8



看上去这个文件是于memcached相关的,但是我系统上没有,于是安装之
$ sudo apt-get install memcached

安装完毕之后,查看了一下他的版本号
$ memcached -v
1.4.5


查看了以下安装情况
最后还是决定把这个文件夹现的这几行(24行附近)
 # VERSION = begin
 #   config = YAML.load(File.read(File.dirname(__FILE__) + '/../VERSION.yml'))
 #   "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
 # end

改成下面这一行
 VERSION = 1.4.5


修改之后,起server 出现了新的问题

二、ruby-debug

/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- ruby-debug (MissingSourceFile)


我猜测是没有安装ruby-debug这个gem包
$ sudo gem install ruby-debug

Building native extensions.  This could take a while...
ERROR:  Error installing ruby-debug:
	ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
	from extconf.rb:1


Gem files will remain installed in /var/lib/gems/1.8/gems/linecache-0.43 for inspection.
Results logged to /var/lib/gems/1.8/gems/linecache-0.43/ext/gem_make.out


这里又提示没有安装 mkmf
三 mkmf

$ sudo gem install mkmf
ERROR:  Could not find a valid gem 'mkmf' (>= 0) in any repository

没有这个gem包
google了一下,没有这个gem,需要安装 ruby1.8-dev
$ sudo apt-get install ruby1.8-dev


再次运行安装ruby-debug的gem
$ sudo gem install ruby-debug

搞定了这个ruby-debug

安装完毕之后
启动server
新的错误

四、RMagick 


/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- RMagick (MissingSourceFile)

$ sudo gem install RMagick
ERROR:  Could not find a valid gem 'RMagick' (>= 0) in any repository

这显然不仅仅是gem的问题
先安装
$ sudo apt-get install libmagick9-dev
$ sudo gem install rmagick


运行server出现新的错误

五、mysql

/var/lib/gems/1.8/gems/activerecord-1.15.2/lib/active_record/vendor/mysql.rb:566:in `initialize': wrong number of arguments (1 for 0) (ArgumentError)
	from /var/lib/gems/1.8/gems/activerecord-1.15.2/lib/active_record/vendor/mysql.rb:566:in `new'
	from /var/lib/gems/1.8/gems/activerecord-1.15.2/lib/active_record/vendor/mysql.rb:566:in `scramble41'
	from /var/lib/gems/1.8/gems/activerecord-1.15.2/lib/active_record/vendor/mysql.rb:144:in `real_connect'
	from /var/lib/gems/1.8/gems/activerecord-1.15.2/lib/active_record/connection_adapters/mysql_adapter.rb:389:in `connect'
	from /var/lib/gems/1.8/gems/activerecord-1.15.2/lib/active_record/connection_adapters/mysql_adapter.rb:152:in `initialize'

怀疑是没有安装libmysql-ruby1.8
于是
$ sudo apt-get install libmysql-ruby1.8 


安装完毕之后,这个牛逼XX的ruby1.8.7+rails的工程终于跑起来了

你可能感兴趣的:(Ruby,MySQL,Java,ActiveRecord,rubygems)