ruby-on-rails - Ruby:使用rails server启动webrick服务器的时候会报错:Could not find a JavaScript runtime
伊谢尔伦
伊谢尔伦 2017-04-21 11:18:34
0
1
758

版本信息:
操作系统: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>'
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

全部回复(1)
迷茫

解决方法:

gem install execjs
gem install therubyracer
sudo apt-get install nodejs

如果使用sudo apt-get install nodejs无法安装的话,可以参考:http://www.cnblogs.com/hwpayg/archive/2012/11/04/2753404.html

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!