首次安装rails并且无法连接到服务器

时间:2015-01-27 12:17:25

标签: ruby ssl gem

我刚刚开始尝试学习代码,而我正试图让我第一次运行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&gt; gem install execjs错误:无法   找到一个有效的宝石'execjs'(&gt; = 0),原因如下:             无法从https:// ruby​​gems.org/下载数据 - SSL_connect返回= 1 errno = 0状态= SSLv3读取服务器证书B:   证书验证失败(https://   api.rubygems.org/latest_specs.4.8.gz)

     

C:\ Sites \ railsbridge \ test_app&gt; gem install execjs --source http://   rubygems.org成功安装了execjs-2.2.2解析   execjs-2.2.2的文档完成安装文档   0秒后执行execjs警告:无法从“https://”中提取数据   rubygems.org/':SSL_connect返回= 1 errno = 0 state = SSLv3读取服务器   证书B:证书验证失败   (https://api.rubygems.org/latest_specs.4.8.gz)安装了1个宝石

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

更新:execjs安装好了。但是当我安装therubyracer时,我得到了这个:

C:\ Sites \ railsbridge \ test_app&gt; gem install 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:in setup_python!': li bv8 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:in 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:in inst all!' from extconf.rb:7:in'

extconf失败,退出代码1

Gem文件将保持安装在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_ make.out

C:\网站\ railsbridge \ test_app&GT;

ps:抱歉我的格式我正在努力学习如何正确使用它

1 个答案:

答案 0 :(得分:0)

尝试在gem文件中添加它

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