我刚开始尝试学习编码,并且试图让Ruby第一次运行。我已经搜索了一个多小时,找不到解决方案。当我尝试连接到服务器时,出现此错误:

C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/execjs-2.2.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 C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/execjs-2.2.2/lib/execjs.rb:5:in `<module:ExecJS>'

        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/execjs-2.2.2/lib/execjs.rb:4:in `<top (required)>
'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/uglifier-2.7.0/lib/uglifier.rb:3:in `require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/uglifier-2.7.0/lib/uglifier.rb:3:in `<top (requir
ed)>'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/runtime.rb:76:in `requi
re'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/runtime.rb:76:in `block
 (2 levels) in require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/runtime.rb:72:in `each'

        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/runtime.rb:72:in `block
 in require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/runtime.rb:61:in `each'

        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/runtime.rb:61:in `requi
re'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler.rb:133:in `require'
        from C:/Sites/railsbridge/test_app/config/application.rb:7:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.
rb:79:in `require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.
rb:79:in `block in server'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.
rb:76:in `tap'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.
rb:76:in `server'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.
rb:40:in `run_command!'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands.rb:17:in `<top
(required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'


然后,当我尝试安装execjs然后安装execjs --source http://rubygems.org时,会发生以下情况:


  C:\ Sites \ railsbridge \ test_app> gem安装execjs错误:无法
  找到一个有效的gem'execjs'(> = 0),这是为什么:
            无法从https://rubygems.org/下载数据-SSL_connect返回= 1 errno = 0状态= SSLv3读取服务器证书B:
  证书验证失败(https://
  api.rubygems.org/latest_specs.4.8.gz)
  
  C:\ Sites \ railsbridge \ test_app> gem install execjs-源http://
  rubygems.org成功安装execjs-2.2.2解析
  execjs-2.2.2的文档完成安装的文档
  0秒后execjs警告:无法从'https://提取数据
  rubygems.org/':SSL_connect返回= 1 errno = 0状态= SSLv3读取服务器
  证书B:证书验证失败
  (https://api.rubygems.org/latest_specs.4.8.gz)已安装1个宝石


我不知道我在做什么错。我也在Windows 7上运行。

更新:execjs安装成功。但是当我安装therubyracer时,我得到了:

C:\ Sites \ railsbridge \ test_app> gem安装therubyracer
暂时增强PATH以包括DevKit ...
构建本机扩展。这可能需要一段时间...
错误:安装therubyracer时出错:
        错误:无法生成gem本机扩展。

C:/RailsInstaller/Ruby2.1.0/bin/ruby.exe -r ./siteconf20150127-8476-14s0h51.rb extconf.rb


创建Makefile
该系统找不到指定的路径。
该系统找不到指定的路径。
该系统找不到指定的路径。
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.7/ext/libv8/builder.rb:68:在setup_python!': libv8 requires python 2 to be installed in order to build, but it is currently not available (RuntimeError) from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.7/ext/libv8/builder.rb:52:in块中
 在build_libv8中!”
        从C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.7/ext/libv8/builder.rb:49:在chdir' from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.7/ext/libv8/builder.rb:49:in build中
_libv8!
        从C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.7/ext/libv8/location.rb:24:在install!' from extconf.rb:7:in

extconf失败,退出代码1

宝石文件将保持安装在C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.7中进行检查
离子。
结果记录到C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/libv8-3.16.14.7/gem_
认出

C:\ Sites \ railsbridge \ test_app>

ps:对我的格式感到抱歉,我正在尝试学习如何正确使用它

最佳答案

尝试将其添加到gem文件中

gem 'execjs'
gem 'therubyracer', :platforms => :ruby

关于ruby - 首次安装导轨并且无法连接到服务器,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28170352/

10-13 05:38