在Windows中,导轨s给出了3个不同的错误,我修复一个,并得到更多

下面有朋友给我指导,我试过了。

运行rails s时出现这些错误

首先我会显示ruby和铁轨的版本

 C:\>ruby -v ruby 2.2.2p95 (2015-04-13 revision 50295) [x64-mingw32] C:\>rails -v Rails 4.2.1 C:\> 

我运行轨道新的QWERTY罚款

 C:\rubyblah>rails new qwerty create create README.rdoc create Rakefile create config.ru create .gitignore create Gemfile create app create app/assets/javascripts/application.js create app/assets/stylesheets/application.css create app/controllers/application_controller.rb create app/helpers/application_helper.rb create app/views/layouts/application.html.erb create app/assets/images/.keep create app/mailers/.keep create app/models/.keep create app/controllers/concerns/.keep create app/models/concerns/.keep create bin create bin/bundle create bin/rails create bin/rake create bin/setup create config create config/routes.rb create config/application.rb create config/environment.rb create config/secrets.yml create config/environments create config/environments/development.rb create config/environments/production.rb create config/environments/test.rb create config/initializers create config/initializers/assets.rb create config/initializers/backtrace_silencers.rb create config/initializers/cookies_serializer.rb create config/initializers/filter_parameter_logging.rb create config/initializers/inflections.rb create config/initializers/mime_types.rb create config/initializers/session_store.rb create config/initializers/wrap_parameters.rb create config/locales create config/locales/en.yml create config/boot.rb create config/database.yml create db create db/seeds.rb create lib create lib/tasks create lib/tasks/.keep create lib/assets create lib/assets/.keep create log create log/.keep create public create public/404.html create public/422.html create public/500.html create public/favicon.ico create public/robots.txt create test/fixtures create test/fixtures/.keep create test/controllers create test/controllers/.keep create test/mailers create test/mailers/.keep create test/models create test/models/.keep create test/helpers create test/helpers/.keep create test/integration create test/integration/.keep create test/test_helper.rb create tmp/cache create tmp/cache/assets create vendor/assets/javascripts create vendor/assets/javascripts/.keep create vendor/assets/stylesheets create vendor/assets/stylesheets/.keep run bundle install Fetching gem metadata from https://rubygems.org/............ Fetching version metadata from https://rubygems.org/... Fetching dependency metadata from https://rubygems.org/.. Resolving dependencies... Using rake 10.4.2 Using i18n 0.7.0 Using json 1.8.2 Using minitest 5.6.1 Using thread_safe 0.3.5 Using tzinfo 1.2.2 Using activesupport 4.2.1 Using builder 3.2.2 Using erubis 2.7.0 Using mini_portile 0.6.2 Using nokogiri 1.6.6.2 Using rails-deprecated_sanitizer 1.0.3 Using rails-dom-testing 1.0.6 Using loofah 2.0.2 Using rails-html-sanitizer 1.0.2 Using actionview 4.2.1 Using rack 1.6.1 Using rack-test 0.6.3 Using actionpack 4.2.1 Using globalid 0.3.5 Using activejob 4.2.1 Using mime-types 2.6.1 Using mail 2.6.3 Using actionmailer 4.2.1 Using activemodel 4.2.1 Using arel 6.0.0 Using activerecord 4.2.1 Using debug_inspector 0.0.2 Using binding_of_caller 0.7.2 Using bundler 1.9.9 Using columnize 0.9.0 Using byebug 5.0.0 Using coffee-script-source 1.9.1.1 Using execjs 2.5.2 Using coffee-script 2.4.1 Using thor 0.19.1 Using railties 4.2.1 Using coffee-rails 4.1.0 Using multi_json 1.11.0 Using jbuilder 2.2.16 Using jquery-rails 4.0.3 Using sprockets 3.1.0 Using sprockets-rails 2.3.1 Using rails 4.2.1 Using rdoc 4.2.0 Using sass 3.4.14 Using tilt 1.4.1 Using sass-rails 5.0.3 Using sdoc 0.4.1 Using sqlite3 1.3.10 Using turbolinks 2.5.3 Using tzinfo-data 1.2015.4 Using uglifier 2.7.1 Using web-console 2.1.2 Bundle complete! 12 Gemfile dependencies, 54 gems now installed. Use `bundle show [gemname]` to see where a bundled gem is installed. 

然后捆绑安装就好了

 C:\rubyblah>cd qwerty C:\rubyblah\qwerty>bundle install Using rake 10.4.2 Using i18n 0.7.0 Using json 1.8.2 Using minitest 5.6.1 Using thread_safe 0.3.5 Using tzinfo 1.2.2 Using activesupport 4.2.1 Using builder 3.2.2 Using erubis 2.7.0 Using mini_portile 0.6.2 Using nokogiri 1.6.6.2 Using rails-deprecated_sanitizer 1.0.3 Using rails-dom-testing 1.0.6 Using loofah 2.0.2 Using rails-html-sanitizer 1.0.2 Using actionview 4.2.1 Using rack 1.6.1 Using rack-test 0.6.3 Using actionpack 4.2.1 Using globalid 0.3.5 Using activejob 4.2.1 Using mime-types 2.6.1 Using mail 2.6.3 Using actionmailer 4.2.1 Using activemodel 4.2.1 Using arel 6.0.0 Using activerecord 4.2.1 Using debug_inspector 0.0.2 Using binding_of_caller 0.7.2 Using columnize 0.9.0 Using byebug 5.0.0 Using coffee-script-source 1.9.1.1 Using execjs 2.5.2 Using coffee-script 2.4.1 Using thor 0.19.1 Using railties 4.2.1 Using coffee-rails 4.1.0 Using multi_json 1.11.0 Using jbuilder 2.2.16 Using jquery-rails 4.0.3 Using bundler 1.9.9 Using sprockets 3.1.0 Using sprockets-rails 2.3.1 Using rails 4.2.1 Using rdoc 4.2.0 Using sass 3.4.14 Using tilt 1.4.1 Using sass-rails 5.0.3 Using sdoc 0.4.1 Using sqlite3 1.3.10 Using turbolinks 2.5.3 Using tzinfo-data 1.2015.4 Using uglifier 2.7.1 Using web-console 2.1.2 Bundle complete! 12 Gemfile dependencies, 54 gems now installed. Use `bundle show [gemname]` to see where a bundled gem is installed. 

然后导轨,我得到这些错误

 C:\rubyblah\qwerty>rails s C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x64-mingw32/lib/sqlite3.rb :6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError) from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x64-mingw32/l ib/sqlite3.rb:6:in `rescue in <top (required)>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x64-mingw32/l ib/sqlite3.rb:2:in `<top (required)>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru ntime.rb:76:in `require' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru ntime.rb:76:in `block (2 levels) in require' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru ntime.rb:72:in `each' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru ntime.rb:72:in `block in require' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru ntime.rb:61:in `each' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru ntime.rb:61:in `require' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler.rb :134:in `require' from C:/rubyblah/qwerty/config/application.rb:7:in `<top (required)>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com mands/commands_tasks.rb:78:in `require' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com mands/commands_tasks.rb:78:in `block in server' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com mands/commands_tasks.rb:75:in `tap' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com mands/commands_tasks.rb:75:in `server' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com mands/commands_tasks.rb:39:in `run_command!' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com mands.rb:17:in `<top (required)>' from bin/rails:4:in `require' from bin/rails:4:in `<main>' C:\rubyblah\qwerty> 

我发现这个关于第一个错误

无法加载这样的文件 – 在rails上的sqlite3 / sqlite3_native(LoadError)

所以我按照说明编辑了相应的gemspec文件

 C:\>dir sql*.gemspec /s/b C:\Ruby22-x64\lib\ruby\gems\2.2.0\specifications\sqlite3-1.3.10-x64-mingw32.gems pec 

我编辑该gemspec文件更改s.require_paths = ["lib"] s.require_paths = ["lib/sqlite3_native"]

那么当我运行rails时,会遇到一大堆错误

 C:\rubyblah\qwerty>rails s C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-mingw32/lib/nokogiri .rb:29:in `require': cannot load such file -- nokogiri/nokogiri (LoadError) from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-mingw32 /lib/nokogiri.rb:29:in `rescue in <top (required)>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-mingw32 /lib/nokogiri.rb:25:in `<top (required)>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/loofah-2.0.2/lib/loofah.rb:3 :in `require' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/loofah-2.0.2/lib/loofah.rb:3 :in `<top (required)>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rails-html-sanitizer-1.0.2/l ib/rails-html-sanitizer.rb:2:in `require' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rails-html-sanitizer-1.0.2/l ib/rails-html-sanitizer.rb:2:in `<top (required)>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_ view/helpers/sanitize_helper.rb:3:in `require' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_ view/helpers/sanitize_helper.rb:3:in `<top (required)>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_ view/helpers/text_helper.rb:32:in `<module:TextHelper>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_ view/helpers/text_helper.rb:29:in `<module:Helpers>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_ view/helpers/text_helper.rb:6:in `<module:ActionView>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_ view/helpers/text_helper.rb:4:in `<top (required)>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_ view/helpers/form_tag_helper.rb:18:in `<module:FormTagHelper>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_ view/helpers/form_tag_helper.rb:14:in `<module:Helpers>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_ view/helpers/form_tag_helper.rb:8:in `<module:ActionView>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_ view/helpers/form_tag_helper.rb:6:in `<top (required)>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_ view/helpers/form_helper.rb:4:in `require' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_ view/helpers/form_helper.rb:4:in `<top (required)>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_ view/helpers.rb:50:in `<module:Helpers>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_ view/helpers.rb:4:in `<module:ActionView>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_ view/helpers.rb:3:in `<top (required)>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp rockets/rails/legacy_asset_tag_helper.rb:7:in `<module:LegacyAssetTagHelper>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp rockets/rails/legacy_asset_tag_helper.rb:6:in `<module:Rails>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp rockets/rails/legacy_asset_tag_helper.rb:4:in `<module:Sprockets>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp rockets/rails/legacy_asset_tag_helper.rb:3:in `<top (required)>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp rockets/rails/helper.rb:54:in `require' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp rockets/rails/helper.rb:54:in `<module:Helper>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp rockets/rails/helper.rb:7:in `<module:Rails>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp rockets/rails/helper.rb:6:in `<module:Sprockets>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp rockets/rails/helper.rb:5:in `<top (required)>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp rockets/railtie.rb:6:in `require' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.3.1/lib/sp rockets/railtie.rb:6:in `<top (required)>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.3/lib/sass/ra ils/railtie.rb:3:in `require' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.3/lib/sass/ra ils/railtie.rb:3:in `<top (required)>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.3/lib/sass/ra ils.rb:11:in `require' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.3/lib/sass/ra ils.rb:11:in `<top (required)>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.3/lib/sass-ra ils.rb:1:in `require' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.3/lib/sass-ra ils.rb:1:in `<top (required)>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru ntime.rb:76:in `require' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru ntime.rb:76:in `block (2 levels) in require' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru ntime.rb:72:in `each' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru ntime.rb:72:in `block in require' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru ntime.rb:61:in `each' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/ru ntime.rb:61:in `require' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler.rb :134:in `require' from C:/rubyblah/qwerty/config/application.rb:7:in `<top (required)>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com mands/commands_tasks.rb:78:in `require' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com mands/commands_tasks.rb:78:in `block in server' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com mands/commands_tasks.rb:75:in `tap' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com mands/commands_tasks.rb:75:in `server' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com mands/commands_tasks.rb:39:in `run_command!' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/com mands.rb:17:in `<top (required)>' from bin/rails:4:in `require' from bin/rails:4:in `<main>' C:\rubyblah\qwerty> 

Solutions Collecting From Web of "在Windows中,导轨s给出了3个不同的错误,我修复一个,并得到更多"

一个选择是降级红宝石到一个稳定/与Windows工作的版本。 另一种选择是安装一个linux虚拟机并在那里安装Ruby。

您需要安装一个与Windows一样稳定的Ruby版本。

不是最新版本的Ruby。 截至撰写最新的是2.2.2,并不稳定与Windows。

即使你是在64位的机器上,稳定的Ruby for Windows也是32位的。

你想要Ruby 2.1.X例如Ruby 2.1.6(最新的2.1.x是好的,2.1.6)而你想要的32位版本

http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.1.6.exe

这里提到http://rubyinstaller.org/downloads/ “我们推荐你使用Ruby 2.1.X安装程序,它们提供了一个稳定的语言和一个兼容和更新的软件包(gems)的广泛列表。

但是,并不是所有的包(宝石)都被维护。 一些较旧的软件包可能与较新版本的Ruby和RubyInstaller不兼容。

Ruby的64位版本在Windows领域是相对较新的,并不是所有的软件包都被更新为兼容。 要使用这个版本,你需要一些关于编译器和解决依赖性问题的知识,如果你只是想玩这个语言,这可能太复杂了。

记下那条指令

所以删除你有任何目前的红宝石。

要删除Ruby,你去开始菜单..Ruby ..然后点击卸载。

这也应该卸载Rails。

并删除任何开发工具包。 devkit可执行文件通过提取安装到您指定的文件夹中,以便只读rmdir /删除该文件夹。

现在安装那个稳定的ruby。2.1.6 32bit安装rails和devkit

该命令来安装rails

gem install rails

一个安装devkit确保你有正确的

例如

http://rubyinstaller.org/downloads/

 WHICH DEVELOPMENT KIT? .... Ruby 1.8.6 to 1.9.3: tdm-32-4.5.2 Ruby 2.0.0 and above (32bits): mingw64-32-4.7.2 Ruby 2.0.0 and above x64 (64bits): mingw64-64-4.7.2 

所以你要

Ruby 2.0.0及以上(32位):mingw64-32-4.7.2

看看可用的开发工具包

开发工具包

用于Ruby 1.8.7和1.9.3:

的devkit-TDM-32-4.5.2-20111229-1559-sfx.exe
用于Ruby 2.0及更高版本(仅限32位版本):

的devkit-mingw64-32-4.7.2-20130224-1151-sfx.exe
用于Ruby 2.0及更高版本(仅适用于x64 – 64位)

的devkit-mingw64-64-4.7.2-20130224-1432-sfx.exe

你要

的devkit-TDM-32-4.5.2-20111229-1559-sfx.exe
用于Ruby 2.0及更高版本(仅限32位版本):

http://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe

按照从这里的指示安装devkit https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

所以说你把它放在c:\devkit

c:\ devkit> ruby​​ dk.rb init

c:\ devkit> ruby​​ dk.rb安装

你可以运行这个命令,虽然我不认为这是必要的c:\ sdfsd> gem install json –platform = ruby

所以现在你有红宝石和rails和devkit安装

rails new <project name>

cd <project name>

bundle install

rails s

http:// localhost:3000 (在您的浏览器中)

它说“欢迎登机”

它看起来像sqlite3宝石没有一个用于Ruby 2.2的胖二进制文件。

你可以等到一个发布,但宝石作家通常只做一个宝石版本的胖二进制版本。

我的建议是降级到Ruby 2.1.6,至少直到发布这些宝石的新版本。