Rails 4.1.0 安裝筆記


最近因為要追學堂上邊的一門雲計算開發課程,所以就對Ruby 來了興趣,買了一本Rails 入門書打算自己搗鼓搗鼓。

可是在安裝ruby 和rails 環境時卻遇到不小的挫折。先是買的那本書中提供的安裝方法因為版本太陳舊了,按照書上

的步驟去做,結果是錯誤一大堆,根本沒法進行下去。這中間因為要找實習單位,也因為那個rails on ruby 的環境安

傷透了我的心,所以就先把這個事情擱置了大約一周左右的時間。

昨天下午想到這個失敗的東西,是很甘心。所以,就重新換了一本比較出名書,我想它既然能很出名,肯定會提供這

個解決難題的辦法了。在網上down 了本《Beginning ruby 4》,草草的瀏覽了前邊的緒論章,就直接殺入chapter 2:

Geting started。但當我看for various reasons,Rails has gained an undeserved  raputation of being difficult to install到

這么一句話時,那真是有點淚奔的趕腳啊,真的!坑爹的翻譯書,你咋就不能把這句話給我說明白呢,也好讓我心里

有個心理准備啊。不過看來全世界有很多童鞋都深受臭名遠揚的rails install 的傷害,哈哈哈,想到這里不覺得自己倒是

輕松不少啊。好了,不扯了,還是把安裝過程貼出來吧,希望對需要的童鞋能有所幫助。

 軟件版本:

     Ruby  2.0

     Rails 4.1

           SQLite  (SQLitshell,SQLitedll)3.6.23

 

 操作系統版本:

     windows 7 professional

 

安裝文件:(這是在終端下操作的,包括一些常見的錯誤)

Microsoft Windows [版本 6.1.7601]
版權所有 (c) 2009 Microsoft Corporation。保留所有權利。

C:\>bundle install
DL is deprecated, please use Fiddle
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Could not locate Gemfile

C:\>cd rubycode

C:\rubycode>dir
驅動器 C 中的卷是 System
卷的序列號是 6EF1-3C06

C:\rubycode 的目錄

2014/04/19  22:09    <DIR>          .
2014/04/19  22:09    <DIR>          ..
2014/04/19  22:09               466 .gitignore
2014/04/19  22:09    <DIR>          app
2014/04/19  22:09    <DIR>          bin
2014/04/19  22:09    <DIR>          config
2014/04/19  22:09               154 config.ru
2014/04/19  22:09    <DIR>          db
2014/04/19  22:09             1,288 Gemfile
2014/04/19  22:09    <DIR>          lib
2014/04/19  22:09    <DIR>          log
2014/04/19  22:09    <DIR>          public
2014/04/19  22:09               249 Rakefile
2014/04/19  22:09               478 README.rdoc
2014/04/19  22:09    <DIR>          test
2014/04/19  22:09    <DIR>          tmp
2014/04/19  22:09    <DIR>          vendor
               5 個文件          2,635 字節
              12 個目錄 19,440,701,440 可用字節

C:\rubycode>bundle install
DL is deprecated, please use Fiddle
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.3.1
Using i18n 0.6.9

Gem::InstallError: The 'json' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.

C:\rubycode>rails server
Could not find gem 'tzinfo-data (>= 0) x86-mingw32' in the gems available on thi
s machine.
Run `bundle install` to install missing gems.

C:\rubycode>bundle install
DL is deprecated, please use Fiddle
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.3.1
Using i18n 0.6.9

Gem::InstallError: The 'json' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.

C:\rubycode>bundle show
DL is deprecated, please use Fiddle
Could not find gem 'tzinfo-data (>= 0) x86-mingw32' in the gems available on
this machine.

C:\rubycode>bundle show
DL is deprecated, please use Fiddle
Could not find gem 'jquery-rails (>= 0) x86-mingw32' in the gems available on
this machine.

C:\rubycode>bundle show


DL is deprecated, please use Fiddle
Could not find gem 'jquery-rails (>= 0) x86-mingw32' in the gems available on
this machine.

C:\rubycode>bundle show
DL is deprecated, please use Fiddle
Could not find gem 'jquery-rails (>= 0) x86-mingw32' in the gems available on
this machine.

C:\rubycode>gem install jquery-rails
Fetching: jquery-rails-3.1.0.gem (100%)
Successfully installed jquery-rails-3.1.0
Parsing documentation for jquery-rails-3.1.0
Installing ri documentation for jquery-rails-3.1.0
1 gem installed

C:\rubycode>bundle install
DL is deprecated, please use Fiddle
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Fetching source index from http://ruby.taobao.org/
Resolving dependencies.....
Using rake 10.3.1
Using i18n 0.6.9

Gem::InstallError: The 'json' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.

C:\rubycode>bundle install
DL is deprecated, please use Fiddle
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Fetching source index from http://ruby.taobao.org/
Resolving dependencies....
Using rake 10.3.1
Using i18n 0.6.9

Gem::InstallError: The 'json' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.

C:\rubycode>

Microsoft Windows [版本 6.1.7601]
版權所有 (c) 2009 Microsoft Corporation。保留所有權利。

C:\Users\Administrator.Admin-PC>cd \

C:\>cd rubycode

C:\rubycode>bundle install
DL is deprecated, please use Fiddle
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Fetching source index from http://ruby.taobao.org/
Resolving dependencies.....................
Using rake 10.3.1
Using i18n 0.6.9

Gem::InstallError: The 'json' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.

C:\rubycode>
C:\rubycode>gem install json -v '1.8.1'
ERROR:  Error installing json:
        The 'json' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'

C:\rubycode>bundleshow
'bundleshow' 不是內部或外部命令,也不是可運行的程序
或批處理文件。

C:\rubycode>bundle show
DL is deprecated, please use Fiddle
Could not find gem 'sass-rails (~> 4.0.3) x86-mingw32' in the gems available on
this machine.

C:\rubycode>gem 'sass-rails <~> 4.0.3> x86-mingw32'
系統找不到指定的文件。

C:\rubycode>gem install 'sass-rails <~> 4.0.3> x86-mingw32'
系統找不到指定的文件。

C:\rubycode>gem install sass-rails -v 4.0.3
Fetching: sass-3.2.19.gem (100%)
Successfully installed sass-3.2.19
Fetching: sprockets-2.11.0.gem (100%)
Successfully installed sprockets-2.11.0
Fetching: sass-rails-4.0.3.gem (100%)
Successfully installed sass-rails-4.0.3
Parsing documentation for sass-3.2.19
Installing ri documentation for sass-3.2.19
Parsing documentation for sass-rails-4.0.3
Installing ri documentation for sass-rails-4.0.3
Parsing documentation for sprockets-2.11.0
Installing ri documentation for sprockets-2.11.0
3 gems installed

C:\rubycode>bundle show
DL is deprecated, please use Fiddle
Could not find gem 'uglifier (>= 1.3.0) x86-mingw32' in the gems available on
this machine.

C:\rubycode>gem install uglifier -v 1.3.0
Fetching: execjs-2.0.2.gem (100%)
Successfully installed execjs-2.0.2
Fetching: uglifier-1.3.0.gem (100%)
Successfully installed uglifier-1.3.0
Parsing documentation for execjs-2.0.2
Installing ri documentation for execjs-2.0.2
Parsing documentation for uglifier-1.3.0
Installing ri documentation for uglifier-1.3.0
2 gems installed

C:\rubycode>bundle install
DL is deprecated, please use Fiddle
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Fetching source index from http://ruby.taobao.org/
Resolving dependencies....
Using rake 10.3.1
Using i18n 0.6.9

Gem::InstallError: The 'json' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.

C:\rubycode>gem install json
ERROR:  Error installing json:
        The 'json' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'

C:\rubycode>ruby dk.rb init
ruby: No such file or directory -- dk.rb (LoadError)

C:\rubycode>cd ../DevKit

C:\DevKit>ruby dk.rb init
[INFO] found RubyInstaller v2.0.0 at C:/Ruby200

Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.

C:\DevKit>ruby dk.rb review
Based upon the settings in the 'config.yml' file generated
from running 'ruby dk.rb init' and any of your customizations,
DevKit functionality will be injected into the following Rubies
when you run 'ruby dk.rb install'.

C:/Ruby200

C:\DevKit>ruby dk.rb install
[INFO] Installing 'C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/defaults/operati
ng_system.rb'
[INFO] Installing 'C:/Ruby200/lib/ruby/site_ruby/devkit.rb'

C:\DevKit>gem install json
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed json-1.8.1
Parsing documentation for json-1.8.1
unable to convert "\x90" from ASCII-8BIT to UTF-8 for ../../extensions/x86-mingw
32/2.0.0/json-1.8.1/json/ext/generator.so, skipping
unable to convert "\x90" from ASCII-8BIT to UTF-8 for ../../extensions/x86-mingw
32/2.0.0/json-1.8.1/json/ext/parser.so, skipping
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/json/ext/generator.so,
skipping
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/json/ext/parser.so, sk
ipping
Installing ri documentation for json-1.8.1
1 gem installed

C:\DevKit>cd /

C:\>cd rubycode

C:\rubycode>bundle install
DL is deprecated, please use Fiddle
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Fetching source index from http://ruby.taobao.org/
Resolving dependencies.....................
Using rake 10.3.1
Using i18n 0.6.9
Using json 1.8.1
Using minitest 5.3.3
Using thread_safe 0.3.3
Using tzinfo 1.1.0
Using activesupport 4.1.0
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.0
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.0
Using mime-types 1.25.1
Using polyglot 0.3.4
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.1.0
Using activemodel 4.1.0
Using arel 5.0.1.20140414130214
Using activerecord 4.1.0
Using bundler 1.6.2
Installing coffee-script-source 1.7.0
Using execjs 2.0.2
Installing coffee-script 2.2.0
Using thor 0.19.1
Using railties 4.1.0
Installing coffee-rails 4.0.1
Using hike 1.2.3
Using multi_json 1.9.2
Installing jbuilder 2.0.6
Using jquery-rails 3.1.0
Using tilt 1.4.1
Using sprockets 2.11.0
Using sprockets-rails 2.1.3
Using rails 4.1.0
Installing rdoc 4.1.1
Using sass 3.2.19
Using sass-rails 4.0.3
Installing sdoc 0.4.0
Using sqlite3 1.3.9
Installing turbolinks 2.2.2
Installing tzinfo-data 1.2014.2
Installing uglifier 2.5.0
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
= 1.8.7 : gem install rdoc-data; rdoc-data --install
= 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!

C:\rubycode>bundle show
DL is deprecated, please use Fiddle
Gems included by the bundle:
  * actionmailer (4.1.0)
  * actionpack (4.1.0)
  * actionview (4.1.0)
  * activemodel (4.1.0)
  * activerecord (4.1.0)
  * activesupport (4.1.0)
  * arel (5.0.1.20140414130214)
  * builder (3.2.2)
  * bundler (1.6.2)
  * coffee-rails (4.0.1)
  * coffee-script (2.2.0)
  * coffee-script-source (1.7.0)
  * erubis (2.7.0)
  * execjs (2.0.2)
  * hike (1.2.3)
  * i18n (0.6.9)
  * jbuilder (2.0.6)
  * jquery-rails (3.1.0)
  * json (1.8.1)
  * mail (2.5.4)
  * mime-types (1.25.1)
  * minitest (5.3.3)
  * multi_json (1.9.2)
  * polyglot (0.3.4)
  * rack (1.5.2)
  * rack-test (0.6.2)
  * rails (4.1.0)
  * railties (4.1.0)
  * rake (10.3.1)
  * rdoc (4.1.1)
  * sass (3.2.19)
  * sass-rails (4.0.3)
  * sdoc (0.4.0)
  * sprockets (2.11.0)
  * sprockets-rails (2.1.3)
  * sqlite3 (1.3.9)
  * thor (0.19.1)
  * thread_safe (0.3.3)
  * tilt (1.4.1)
  * treetop (1.4.15)
  * turbolinks (2.2.2)
  * tzinfo (1.1.0)
  * tzinfo-data (1.2014.2)
  * uglifier (2.5.0)

C:\rubycode>rails server
=> Booting WEBrick
=> Rails 4.1.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0
.0.1 (--binding option)
=> Ctrl-C to shutdown server
[2014-04-20 10:27:27] INFO  WEBrick 1.3.1
[2014-04-20 10:27:27] INFO  ruby 2.0.0 (2013-11-22) [i386-mingw32]
[2014-04-20 10:27:27] INFO  WEBrick::HTTPServer#start: pid=8780 port=3000


Started GET "/" for 127.0.0.1 at 2014-04-20 10:29:10 +0800
Processing by Rails::WelcomeController#index as HTML
  Rendered C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.1.0/lib/rails/template
s/rails/welcome/index.html.erb (31.0ms)
Completed 200 OK in 468ms (Views: 301.0ms | ActiveRecord: 0.0ms)


Started GET "/rails/info/properties" for 127.0.0.1 at 2014-04-20 10:29:34 +0800
Processing by Rails::InfoController#properties as */*
  Rendered C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.1.0/lib/rails/template
s/rails/info/properties.html.erb (2.0ms)
Completed 200 OK in 927ms (Views: 426.0ms | ActiveRecord: 35.0ms)


Started GET "/" for 127.0.0.1 at 2014-04-20 10:29:44 +0800
Processing by Rails::WelcomeController#index as HTML
  Rendered C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.1.0/lib/rails/template
s/rails/welcome/index.html.erb (0.0ms)
Completed 200 OK in 29ms (Views: 27.0ms | ActiveRecord: 0.0ms)
[2014-04-20 10:30:19] INFO  going to shutdown ...
[2014-04-20 10:30:19] INFO  WEBrick::HTTPServer#start done.
Exiting
終止批處理操作嗎(Y/N)? y

C:\rubycode>

 

至此,整個rails環境的終於搞定,嘿嘿。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM