ruby - 第一次安装 rails 无法连接到服务器

标签 ruby ssl rubygems

我刚刚开始尝试学习编码,而且我正在尝试让 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>'

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

C:\Sites\railsbridge\test_app>gem install execjs ERROR: Could not find a valid gem 'execjs' (>= 0), here is why: Unable to download data from https:// rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read serv er certificate B: certificate verify failed (https:// api.rubygems.org/latest_specs.4.8.gz)

C:\Sites\railsbridge\test_app>gem install execjs --source http:// rubygems.org Successfully installed execjs-2.2.2 Parsing documentation for execjs-2.2.2 Done installing documentation for execjs after 0 seconds WARNING: Unable to pull data from 'https:// rubygems.org/': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/latest_specs.4.8.gz) 1 gem installed

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

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

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

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

创建生成文件 该系统找不到指定的路径。 该系统找不到指定的路径。 该系统找不到指定的路径。 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 需要安装 python 2 才能构建,但目前不可用(RuntimeError) 来自 C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.7/ext/libv8/builder.rb:52:in block 在 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 ' 来自 C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.7/ext/libv8/builder.rb:49:inbuild _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 全部!' 来自 extconf.rb:7:in'

extconf 失败,退出代码 1

Gem 文件将保留安装在 C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.7 以供检查 ionic 。 结果记录到 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 - 第一次安装 rails 无法连接到服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28170352/

相关文章:

html - 在安全页面上嵌入不安全的 Flash 对象

java - 将 Wildfly 14 双向 SSL 限制为特定客户端

css - "compass watch"编译一个文件而不是另一个

ruby - 通过 ruby​​gems 安装 Kyoto Cabinet 失败

ruby - 如何强制 gem install 也下载文档文件?

ruby-on-rails - `:location => ...`格式语句中的 `head :ok`和 'respond_to'是什么意思?

ruby-on-rails - Rails 3 iso-3166-country-select 插件如何包含空白并设置优先级国家?

ruby-on-rails - 如何允许正则表达式为空?

arrays - Ruby:通过将数组映射到数组来构建哈希

amazon-web-services - AWS 证书管理器会自动部署到我的资源吗?