3

关于 Windows 7 中的 Ruby on rails。安装 railsinstaller 后,我面临很多问题,不确定原因是什么?

PS:我在寻找类似问题的答案时在其他地方的堆栈溢出上发布了这个问题,一位绅士建议我将我的问题放在单独的线程上。就这样。

Windows 7 落后于代理和 websense。我以管理员身份运行所有应用程序。我想知道我是否因为我面临的问题离开了任何网站/博客。虽然这是我在用尽阅读和搜索选项来解决它之后,关于堆栈溢出中的 ROR 的第一个问题。

我什至无法做到

$ gem install rubygems-update 

虽然我的路径是正确的并且显示

c:\>gem sources

展示

http://rubygems.org.

作为唯一来源。

即使是简单的数据库创建,我仍然会收到以下错误。这是在示例 Rails 项目的根目录中给出的,即 SampleROR。请提供任何帮助。

$ rake db:create
The i18n gem is not available. Please add it to your Gemfile and run bundle install
rake aborted!
cannot load such file -- i18n
c:/RailsInstaller/DevKit/home/anil-ku/SampleROR/config/application.rb:3:in `require'
c:/RailsInstaller/DevKit/home/anil-ku/SampleROR/config/application.rb:3:in `<top (required)>'
c:/RailsInstaller/DevKit/home/anil-ku/SampleROR/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)

请注意,我无法做到

C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem update --system
ERROR:  While executing gem ... (Zlib::GzipFile::Error)
    not in gzip format

使用最新版本的rails,使用railsinstaller一键安装windows。在此之后我进行了捆绑安装,运行成功,但问题并没有消失。

anil-ku@hostname ~/SampleROR
$ bundle install
Using rake (10.0.2)
**Using i18n (0.6.1)**
Using multi_json (1.4.0)
Using activesupport (3.2.1)
Using builder (3.0.4)
Using activemodel (3.2.1)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.1)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.4.4)
Using actionmailer (3.2.1)
Using arel (3.0.2)
Using tzinfo (0.3.35)
Using activerecord (3.2.1)
Using activeresource (3.2.1)
Using bundler (1.0.22)
Using coffee-script-source (1.4.0)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.7.5)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.2.1)
Using coffee-rails (3.2.2)
Using jquery-rails (2.1.4)
Using rails (3.2.1)
Using sass (3.2.3)
Using sass-rails (3.2.5)
Using sqlite3 (1.3.6)
Using uglifier (1.3.0)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem
is installed.

anil-ku@DS-7071BC8FD6C4 ~/SampleROR
**$ bundle show i18n**
c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/i18n-0.6.1

当我列出

$gem list -local
actionmailer (3.2.1)
actionpack (3.2.1)
activemodel (3.2.9, 3.2.1)
activerecord (3.2.1)
activerecord-sqlserver-adapter (3.2.1)
activeresource (3.2.1)
activesupport (3.2.9, 3.2.1)
archive-tar-minitar (0.5.2)
arel (3.0.2)
bigdecimal (1.1.0)
builder (3.0.4, 3.0.0)
bundler (1.0.22)
cgi_multipart_eof_fix (2.5.0)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.4.0, 1.2.0)
columnize (0.3.6)
daemons (1.1.9)
debugger-linecache (1.1.2)
debugger-ruby_core_source (1.1.5)
deprecated (3.0.1, 2.0.1)
erubis (2.7.0)
execjs (1.4.0, 1.3.0)
fastthread (1.0.7)
gem_plugin (0.2.3)
hike (1.2.1)
hoe (3.3.1)
**i18n (0.6.1, 0.6.0)**
io-console (0.3)
journey (1.0.4, 1.0.2)
jquery-rails (2.1.4)
json (1.7.5, 1.5.4)
mail (2.4.4, 2.4.1)
mime-types (1.19, 1.17.2)
minitest (4.3.3, 2.5.1)
multi_json (1.4.0, 1.3.7, 1.1.0)
mysql2 (0.3.11)
permutation (0.1.8)
pg (0.13.1 x86-mingw32)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2, 1.1)
rack-ssl (1.3.2)
rack-test (0.6.2, 0.6.1)
rails (3.2.1)
railties (3.2.1)
rake (10.0.2, 0.9.2.2)
rake-compiler (0.8.1)
rb-readline (0.4.2)
rbx-require-relative (0.0.9)
rdoc (3.12, 3.9.4)
ruby_core_source (0.1.5)
rubyzip (0.9.6.1)
sass (3.2.3)
sass-rails (3.2.5)
sdoc (0.3.20)
sprockets (2.1.3, 2.1.2)
sqlite3 (1.3.6 x86-mingw32, 1.3.5 x86-mingw32)
sqlite3-ruby (1.3.3)
thor (0.14.6)
tilt (1.3.3)
tiny_tds (0.5.1 x86-mingw32)
treetop (1.4.12, 1.4.10)
tzinfo (0.3.35, 0.3.31)
uglifier (1.3.0)

它显示已安装 i18n。不确定是什么问题。

$ rails --version
Rails 3.2.1

此外,下载 gem 包并使用ruby​​ setup.rb运行它也不起作用

C:\RailsInstaller\rubygems>ruby setup.rb
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems.rb:480:in `find_files': undefined method `map' for Gem::Specification:Class (NoMethodError)
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems.rb:1085:in `load_plugins'
        from C:/RailsInstaller/rubygems/lib/rubygems/gem_runner.rb:84:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from setup.rb:25:in `<main>'

C:\RailsInstaller\rubygems>

我的宝石版本是

C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem -v
1.8.16

我尝试从站点手动下载 gem(来自http://rubygems.org/gems/)并安装了其中的一些。所以能够为大多数其他宝石安装一些时间,它会给出如下错误

C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem install mongrel
ERROR:  While executing gem ... (Zlib::GzipFile::Error)
    not in gzip format

C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem install mongrel_services
ERROR:  While executing gem ... (Zlib::GzipFile::Error)
    not in gzip format

C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem install mongrel_service
ERROR:  While executing gem ... (Zlib::GzipFile::Error)
    not in gzip format

C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem install mongrel_service-0.4.0.gem
ERROR:  While executing gem ... (Zlib::GzipFile::Error)
    not in gzip format

C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem install mongrel-1.1.5.gem
ERROR:  While executing gem ... (Zlib::GzipFile::Error)
    not in gzip format

C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem install mongrel2-0.34.0.gem
ERROR:  While executing gem ... (Zlib::GzipFile::Error)
    not in gzip format

C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem install win32-api-1.4.8.gem
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed win32-api-1.4.8
1 gem installed
Installing ri documentation for win32-api-1.4.8...
Installing RDoc documentation for win32-api-1.4.8...

C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem install windows-api-0.4.2.gem
ERROR:  While executing gem ... (Zlib::GzipFile::Error)
    not in gzip format

最后我的gem环境细节是

C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.16
  - RUBY VERSION: 1.9.3 (2012-02-16 patchlevel 125) [i386-mingw32]
  - INSTALLATION DIRECTORY: C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/RailsInstaller/Ruby1.9.3/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mingw32
  - GEM PATHS:
     - C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1
     - C:/Users/anil-ku/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>

我注意到 C:/Users/anil-ku/.gem/ruby/1.9.1 下没有像 ruby​​ 文件夹一样的东西,上面唯一的东西是一个名为 specs 的文件夹,看起来无关紧要。

路径环境也是windows是

C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>echo %PATH%
C:\RailsInstaller\Ruby1.9.3\bin;C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\bin;C:\RailsInstaller\DevKit\bin;C:\RailsInstaller\Git\c
md;C:\RailsInstaller\Ruby1.9.3\bin;C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\bin;C:\RailsInstaller\DevKit\bin;C:\RailsInstaller\Gi
t\cmd;C:\RailsInstaller\Git\cmd;C:\RailsInstaller\Ruby1.9.3\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\Syste
m32\WindowsPowerShell\v1.0\;;C:\Program Files\cvsnt;C:\Program Files\TortoiseSVN\bin;d:\RailsInstaller\Git\cmd;d:\RailsInstaller\Ruby1.9
.3\bin

有关如何继续进行上述简单数据库连接和/或如何完全安装 gem 的任何帮助?

4

1 回答 1

0

您需要为 ruby​​gems 设置代理设置。例如像这样设置环境变量:

SET HTTP_PROXY= http://wolfbyte:secret@pigsy:8080

来自https://stackoverflow.com/a/4431/192221

于 2013-01-07T08:51:49.217 回答