$rails new webapp
项目建立成功。
cd webapp
修改 Gemfile 的源:source 'http://ruby.taobao.org'
$bundle install
启动
$rails s
/home/wangliang/.rvm/gems/ruby-2.0.0-p247/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
from /home/wangliang/.rvm/gems/ruby-2.0.0-p247/gems/execjs-1.4.0/lib/execjs.rb:5:in
module:ExecJS'
from /home/wangliang/.rvm/gems/ruby-2.0.0-p247/gems/execjs-1.4.0/lib/execjs.rb:4:in <top (required)>'
from /home/wangliang/.rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.1.1/lib/uglifier.rb:3:in
require'
from /home/wangliang/.rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.1.1/lib/uglifier.rb:3:in <top (required)>'
from /home/wangliang/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in
require'
from /home/wangliang/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in block (2 levels) in require'
from /home/wangliang/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in
each'
from /home/wangliang/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in block in require'
from /home/wangliang/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in
each'
from /home/wangliang/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in require'
from /home/wangliang/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler.rb:132:in
require'
from /home/wangliang/ruby-china/config/application.rb:7:in <top (required)>'
from /home/wangliang/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:76:in
require'
from /home/wangliang/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:76:in block in <top (required)>'
from /home/wangliang/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73:in
tap'
from /home/wangliang/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73:in <top (required)>'
from bin/rails:4:in
require'
解决办法:
vim Gemfile
添加
gem 'execjs'
gem 'therubyracer'
$bundle install
$rails s
=> Booting WEBrick
=> Rails 4.0.0 application starting in development on http://0.0.0.0:3000
=> Run rails server -h
for more startup options
=> Ctrl-C to shutdown server
[2013-07-13 00:11:52] INFO WEBrick 1.3.1
[2013-07-13 00:11:52] INFO ruby 2.0.0 (2013-06-27) [x86_64-linux]
[2013-07-13 00:11:52] INFO WEBrick::HTTPServer#start: pid=28681 port=3000