ruby教程启动我的应用程序

时间:2013-09-22 00:56:06

标签: ruby-on-rails ruby

我刚开始使用基于Unix的操作系统 我安装了RVM来执行像windows(dos)这样的基本教程,但是我得到了 一个错误,我试图在root /用户shell中做同样的工作但是是一样的 当我运行rails server时,我收到此消息:

/usr/local/rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.1/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 /usr/local/rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.1/lib/execjs.rb:5:in `<module:ExecJS>'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.1/lib/execjs.rb:4:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.2.1/lib/uglifier.rb:3:in `require'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.2.1/lib/uglifier.rb:3:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /home/raul/blog/config/application.rb:7:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
    from /usr/local/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'
    from bin/rails:4:in `<main>'

我恢复了宝石命令,圆顶问题也成立了。 Execjs已在我的机器root->user中多次安装。这就是我gem check所得到的:

json-1.8.0.gem has 12 problems
  ext/json/ext/generator/.RUBYARCHDIR.time:
    Extra file
  ext/json/ext/generator/Makefile:
    Extra file
  ext/json/ext/generator/generator.o:
    Extra file
  ext/json/ext/generator/generator.so:
    Extra file
  ext/json/ext/generator/siteconf20130920-14093-1b8hzo9.rb:
    Extra file
  ext/json/ext/parser/.RUBYARCHDIR.time:
    Extra file
  ext/json/ext/parser/Makefile:
    Extra file
  ext/json/ext/parser/parser.o:
    Extra file
  ext/json/ext/parser/parser.so:
    Extra file
  ext/json/ext/parser/siteconf20130920-14093-zefm93.rb:
    Extra file
  lib/json/ext/generator.so:
    Extra file
  lib/json/ext/parser.so:
    Extra file

2 个答案:

答案 0 :(得分:1)

安装节点

sudo apt-get install nodejs

接着是

gem install execjs

或者只是将gem 'execjs'放在你的gem文件中。

编辑:我根据您的编辑和评论编辑我的答案。

答案 1 :(得分:1)

只需向您的Gemfile添加JavaScript运行时(例如,execJS):gem 'execjs'

然后,只需运行bundle install即可。