ruby-on-rails - Ruby:使用rails server启动webrick服务器的时候会报错:Could not find a JavaScript runtime
问题描述
版本信息:操作系统:KaliRuby:2.0.0p353Rails: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>’
问题解答
回答1:解决方法:
gem install execjsgem install therubyracersudo apt-get install nodejs
如果使用sudo apt-get install nodejs无法安装的话,可以参考:http://www.cnblogs.com/hwpayg/archive/2012/11/04/2753404.html
相关文章:
1. javascript - 怎样定位一个动作调用了哪个js,不打断点调试?2. javascript - webpack 打包 reactjs项目 css 分离3. javascript - vuex中子组件无法调用公共状态4. Span标签5. javascript - ios上fixed定位问题,定位在底部的按钮不显示了,但是又可以点击到,换了一个类名就可以显示了,但是设置的字体大小却失效了6. javascript - 请教移动端从详情页返回到列表页原来位置的问题?7. javascript - 关于微信扫一扫的技术问题8. javascript - (_a = [""], _a.raw = [""],....); js一个小括号的是什么意思?9. javascript - js正则替换日期格式问题10. javascript - Vue.js的ElementUI库中,如何主动触发checkbox组件的change事件?
