ROR:rails server :Could not find a JavaScript runtime

by http://www.88lei.com


$rails new demo

$cd demo

$rails server


/usr/lib/ruby/gems/1.9.1/gems/execjs-1.3.0/lib/execjs/runtimes.rb:50:in `autodetect':Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

    from /usr/lib/ruby/gems/1.9.1/gems/execjs-1.3.0/lib/execjs.rb:5:in `<module:ExecJS>'
    from /usr/lib/ruby/gems/1.9.1/gems/execjs-1.3.0/lib/execjs.rb:4:in `<top (required)>'
    from /usr/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
    from /usr/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'
    from /usr/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
    from /usr/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'
    from /usr/lib/ruby/gems/1.9.1/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'
    from /usr/lib/ruby/gems/1.9.1/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `<top (required)>'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `require'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `each'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `block in require'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `each'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `require'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler.rb:122:in `require'
    from /home/acer/demo/config/application.rb:7:in `<top (required)>'
    from /usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/commands.rb:53:in `require'
    from /usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/commands.rb:53:in `block in <top (required)>'
    from /usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/commands.rb:50:in `tap'
    from /usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

acer@ubuntu:~/demo$ sudo gem install nodejs   ///提示找不到

下载node.js 源码:http://nodejs.org/#download  到node-v0.6.11.tar.gz

tar xzvf node-v0.6.11.tar.gz

cd node-v0.6.11

./configure

make

sudo make install

再 cd /home/acer/demo

执行 rails server

=> Booting WEBrick
=> Rails 3.2.1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-02-19 22:58:02] INFO  WEBrick 1.3.1
[2012-02-19 22:58:02] INFO  ruby 1.9.2 (2010-08-18) [i686-linux]
[2012-02-19 22:58:02] INFO  WEBrick::HTTPServer#start: pid=10637 port=3000


Started GET "/assets/rails.png" for 127.0.0.1 at 2012-02-19 23:00:33 +0800
Served asset /rails.png - 200 OK (41ms)

提示web server启动成功:

到firefox中打开http://localhost:3000 ,WOW! Rails 界面 出现了。

/

execjs根据不同平台依赖不同的js runtime:
therubyracer - Google V8 embedded within Ruby
therubyrhino - Mozilla Rhino embedded within JRuby
Johnson - Mozilla SpiderMonkey embedded within Ruby
Mustang - Mustang V8 embedded within Ruby
Node.js
Apple JavaScriptCore - Included with Mac OS X
Mozilla SpiderMonkey
Microsoft Windows Script Host (JScript)
 
 
http://www.88lei.com点击打开链接



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值