2013-10-09 131 views
0

我想在debian上的rails上安裝ruby ...我安裝了所有東西。Ruby on Rails - 在Debian上安裝execjs

我也安裝了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中後作出重啓...

+0

請將您的Gemfile的副本,並給我們你怎麼會有的Ruby/Rails細節安裝在你的系統上。你在使用RVM嗎? – Kosmonaut

回答

5

爲平臺,其中有二進制版本的therubyracer gem可用,除了ruby和rubygems之外,沒有任何依賴關係。如果您的系統沒有二進制版本,那麼您需要從源代碼編譯它。要做到這一點,你的系統上必須安裝v8> 3.11.8。

嘗試增加以下到您的Gemfile

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

現在,cd到你的項目,並捆綁安裝

$ cd <project> 
$ bundle install 
+1

我在rails'3.2.14'中遇到了同樣的問題,添加上面的兩個寶石幫助我擺脫了錯誤。謝謝。 – Ranjan