未知的编码名称 - CP720(ArgumentError) - 启动服务器时ruby on rails错误

时间:2016-08-13 18:35:22

标签: ruby-on-rails ruby ruby-on-rails-3 ruby-on-rails-4

我的rails应用程序在启动时抛出此错误。造成这种情况的可能原因是什么?

c:\test_install>rails server
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/win32/registry.rb:70:in `find': unkno
wn encoding name - CP720 (ArgumentError)
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/win32/registry.rb:70:in
`<module:Win32>'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/win32/registry.rb:3:in `
<top (required)>'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel
_require.rb:55:in `require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel
_require.rb:55:in `require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/win32/resolv.rb:6:in `<t
op (required)>'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel
_require.rb:55:in `require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel
_require.rb:55:in `require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/resolv.rb:170:in `<class
:Hosts>'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/resolv.rb:167:in `<class
:Resolv>'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/resolv.rb:37:in `<top (r
equired)>'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel
_require.rb:55:in `require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel
_require.rb:55:in `require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/remote_fetcher.
rb:5:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel
_require.rb:55:in `require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel
_require.rb:55:in `require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.12.0
.pre.1/lib/bundler/gem_remote_fetcher.rb:2:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel
_require.rb:55:in `require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel
_require.rb:55:in `require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.12.0
.pre.1/lib/bundler.rb:7:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel
_require.rb:55:in `require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel
_require.rb:55:in `require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.12.0
.pre.1/lib/bundler/setup.rb:5:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel
_require.rb:135:in `require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel
_require.rb:135:in `rescue in require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel
_require.rb:144:in `require'
        from c:/test_install/config/boot.rb:3:in `<top (required)>'
        from bin/rails:3:in `require_relative'
        from bin/rails:3:in `<main>'
c:\test_install>gem install rails

1 个答案:

答案 0 :(得分:4)

代码页720 是MS-DOS使用的阿拉伯字符。

建议您将终端代码页切换为Ruby理解的内容,例如拉丁字母的Windows 1252字符编码。

您可以通过此命令解决问题

chcp 1252

更好的方法是永久强制终端使用正确的代码页,即使用像this这样的批处理。

此外,最好在rails开发人员中使用带rvmrbenv的Linux作为ruby。