Ruby on Rails - 在Debian上安装execjs

时间:2013-10-09 17:28:19

标签: ruby-on-rails debian execjs

我正在尝试在debian上的rails上安装ruby ...我安装了所有内容。

我也安装了execjs,therubyracer和node.js.

每次我想创建一个新的控制器,它说:

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

安装了execjs,therubyracer和node.js之后我重新启动了......

1 个答案:

答案 0 :(得分:5)

对于有二元版本的therubyracer gem可用的平台,除了ruby和rubygems之外没有其他依赖项。如果系统没有二进制版本,则需要从源代码编译它。要做到这一点,你必须有v8&gt; 3.11.8安装在系统的某个地方。

尝试在Gemfile中添加以下内容

gem 'therubyracer', '0.11.0beta5'
gem 'libv8', '~> 3.11.8'

现在,cd到您的项目并捆绑安装

$ cd <project>
$ bundle install