尝试使用命令部署旧项目时出现问题:
ruby脚本/服务器-e production -p 999
结果:
D:/InstantRails/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require': cannot load such file -- iconv (LoadError)
from D:/InstantRails/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require'
from D:/InstantRails/ruby/lib/ruby/gems/2.3.0/gems/activesupport-2.3.10/lib/active_support/inflector.rb:3:in `<top (required)>'
from D:/InstantRails/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from D:/InstantRails/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from D:/InstantRails/ruby/lib/ruby/gems/2.3.0/gems/activesupport-2.3.10/lib/active_support/core_ext/integer/inflections.rb:1:in `<top (required)>'
from D:/InstantRails/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from D:/InstantRails/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from D:/InstantRails/ruby/lib/ruby/gems/2.3.0/gems/activesupport-2.3.10/lib/active_support/core_ext/integer.rb:2:in `<top (required)>'
from D:/InstantRails/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from D:/InstantRails/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from D:/InstantRails/ruby/lib/ruby/gems/2.3.0/gems/activesupport-2.3.10/lib/active_support/core_ext.rb:8:in `block in <top (required)>'
from D:/InstantRails/ruby/lib/ruby/gems/2.3.0/gems/activesupport-2.3.10/lib/active_support/core_ext.rb:8:in `each'
from D:/InstantRails/ruby/lib/ruby/gems/2.3.0/gems/activesupport-2.3.10/lib/active_support/core_ext.rb:8:in `<top (required)>'
from D:/InstantRails/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from D:/InstantRails/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from D:/InstantRails/ruby/lib/ruby/gems/2.3.0/gems/activesupport-2.3.10/lib/active_support.rb:56:in `<top (required)>'
from D:/InstantRails/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from D:/InstantRails/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from D:/InstantRails/ruby/lib/ruby/gems/2.3.0/gems/rails-2.3.10/lib/commands/server.rb:1:in `<top (required)>'
from D:/InstantRails/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from D:/InstantRails/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from script/server:3:in `<main>'
我的版本是:
Ruby -v
D:\InstantRails\rails_apps\TestManager>ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x64-mingw32]
Gem -v
2.6.7
iconv gem安装的结果:
gem install iconv - --with-iconv-include = D:/ iconv / include --with-iconv-lib = D:/ iconv / lib
结果:
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-iconv-include=D:/iconv/include --with-iconv-lib=D:/iconv/lib'
This could take a while...
ERROR: Error installing iconv:
ERROR: Failed to build gem native extension.
current directory: D:/InstantRails/ruby/lib/ruby/gems/2.3.0/gems/iconv-1.0.4/ext/iconv
D:/InstantRails/ruby/bin/ruby.exe -r ./siteconf20161021-4952-wjxi9k.rb extconf.rb --with-iconv-include=D:/iconv/include --with-iconv-lib=D:/iconv/lib
checking for rb_enc_get() in ruby/encoding.h... yes
checking for rb_sys_fail_str() in ruby.h... yes
checking for iconv() in iconv.h... no
checking for iconv() in -liconv... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=D:/InstantRails/ruby/bin/$(RUBY_BASE_NAME)
--with-iconv-dir
--without-iconv-dir
--with-iconv-include=${iconv-dir}/include
--with-iconv-lib=${iconv-dir}/lib
--enable-config-charset
--disable-config-charset
--with-config-charset
--without-config-charset
--with-iconvlib
--without-iconvlib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
D:/InstantRails/ruby/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/iconv-1.0.4/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in D:/InstantRails/ruby/lib/ruby/gems/2.3.0/gems/iconv-1.0.4 for inspection.
Results logged to D:/InstantRails/ruby/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/iconv-1.0.4/gem_make.out
答案 0 :(得分:0)
好像你没有安装iconv
gem
查看类似的question。
答案 1 :(得分:0)
您可能缺少适用于Windows的Devkit:http://rubyinstaller.org/add-ons/devkit/
另请注意,您应该在安装ruby的同一个arch中安装devkit(即:两个64位版本) - ppl经常安装一个32和一个64版本,这也会导致错误。
祝你好运