您的位置:首页 > 编程语言 > Ruby

Ruby on Rails Tutorial 第2版 学习笔记

2013-09-11 16:38 387 查看
Ruby on Rails Tutorial 第2版

在线阅读:http://railstutorial-china.org/

英文版:http://ruby.railstutorial.org/ruby-on-rails-tutorial-book

本人环境:

windows7下用VirtualBox装的Ubuntu 13.04

第一章 从零到部署

安装rvm,这样就能自由的切换ruby版本

apt-get  install curl
#安装rvm
curl -L https://get.rvm.io | bash
#启动rvm
source /home/mafei/.rvm/scripts/rvm


Installing RVM to /home/mafei/.rvm/
Adding rvm PATH line to /home/mafei/.bashrc /home/mafei/.zshrc.
Adding rvm loading line to /home/mafei/.bash_profile /home/mafei/.zprofile.
Installation of RVM in /home/mafei/.rvm/ is almost complete:

* To start using RVM you need to run `source /home/mafei/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.

# mafei,
#
# Thank you for using RVM!
# I sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne

# In case of problems:
# run and read: rvm notes
# read docs: http://rvm.io/ # talk to us: http://webchat.freenode.net/?channels=rvm (http://freenode.net/faq.shtml#plusr)
# read cheatsheet: http://cheat.errtheblog.com/s/rvm # watch screencast: http://screencasts.org/episodes/how-to-use-rvm # open a bug report: https://github.com/wayneeseguin/rvm/issues 
* WARNING: You have '~/.profile' file, you might want to load it,
to do that add the following line to '/home/mafei/.bash_profile':

source ~/.profile


执行到

gem install rails --version 4.0.0 --no-ri --no-rdoc


安装rails报错

/home/mafei/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/atomic-1.1.14/lib/atomic/ruby.rb
Building native extensions.  This could take a while...
/home/mafei/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
creating Makefile
make
compiling atomic_reference.c
linking shared-object atomic_reference.so
make install
/usr/bin/install -c -m 0755 atomic_reference.so /home/mafei/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/atomic-1.1.14/lib/home/mafei/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/i686-linux
/usr/bin/install: 无法创建普通文件"/home/mafei/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/atomic-1.1.14/lib/home/mafei/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/i686-linux": 没有那个文件或目录
make: *** [install-so] 错误 1
ERROR:  Error installing rails:
ERROR: Failed to build gem native extension.

Building has failed. See above output for more information on the failure.

Gem files will remain installed in /home/mafei/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/atomic-1.1.14 for inspection.
Results logged to /home/mafei/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/atomic-1.1.14/ext/gem_make.out


无奈,执行gem update --system ,将gem升级到最新

再次执行,安装rails成功。

启动rails server,提示

Could not find a Javascript runtime

安装nodeJS

apt-get install nodejs
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: