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环境的终于搞定,嘿嘿。