版本信息:
操作系统:Kali
Ruby:2.0.0p353
Rails:4.1.0
报错信息如下所示:
root@kali:/var/ruby/blog# rails server
/usr/local/rvm/gems/ruby-2.0.0-p353/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/rvm/gems/ruby-2.0.0-p353/gems/execjs-2.0.2/lib/execjs.rb:5:in `<module:ExecJS>'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/execjs-2.0.2/lib/execjs.rb:4:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/uglifier-2.5.0/lib/uglifier.rb:3:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/uglifier-2.5.0/lib/uglifier.rb:3:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `each'
from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `block in require'
from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `each'
from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.6.2/lib/bundler.rb:132:in `require'
from /var/ruby/blog/config/application.rb:7:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:79:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:79:in `block in server'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `tap'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `server'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-4.1.0/lib/rails/commands.rb:17:in `<top (required)>'
from /var/ruby/blog/bin/rails:8:in `require'
from /var/ruby/blog/bin/rails:8:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/spring-1.1.2/lib/spring/client/rails.rb:27:in `load'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/spring-1.1.2/lib/spring/client/rails.rb:27:in `call'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/spring-1.1.2/lib/spring/client/command.rb:7:in `call'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/spring-1.1.2/lib/spring/client.rb:26:in `run'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/spring-1.1.2/bin/spring:48:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/spring-1.1.2/lib/spring/binstub.rb:11:in `load'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/spring-1.1.2/lib/spring/binstub.rb:11:in `<top (required)>'
from /var/ruby/blog/bin/spring:16:in `require'
from /var/ruby/blog/bin/spring:16:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
解决方法:
如果使用
sudo apt-get install nodejs
无法安装的话,可以参考:http://www.cnblogs.com/hwpayg/archive/2012/11/04/2753404.html