【发布时间】:2015-03-26 01:26:43
【问题描述】:
我刚刚开始尝试学习编码,并且我正在尝试让 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 install execjs 错误:不能 找到一个有效的 gem 'execjs' (>= 0),原因如下: 无法从 https://rubygems.org/ 下载数据 - SSL_connect 返回=1 errno=0 state=SSLv3 读取服务器证书 B: 证书验证失败(https:// api.rubygems.org/latest_specs.4.8.gz)
C:\Sites\railsbridge\test_app>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 状态=SSLv3 读取服务器 证书 B:证书验证失败 (https://api.rubygems.org/latest_specs.4.8.gz) 已安装 1 个 gem
我不知道我做错了什么。我也在 Windows 7 上运行。
更新:execjs 安装正常。但是当我安装 therubyracer 时,我得到了这个:
C:\Sites\railsbridge\test_app>gem install therubyracer 暂时增强 PATH 以包含 DevKit... 构建原生扩展。这可能需要一段时间... 错误:安装 rubyracer 时出错: 错误:无法构建 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:inblock
在 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: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
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:\Sites\railsbridge\test_app>
ps:对不起我的格式我正在尝试学习如何正确使用它
【问题讨论】:
-
您需要
nodejsgem,如this question -
看来你使用的是windows操作系统,所以去这个链接railsinstaller.org/en下载完整的bundle,它会安装所有的依赖来运行一个rails服务器,虽然安装nodejs会解决这个问题。
-
我最初从 railsinstaller.org 安装了 ruby 和 rails。我也刚刚安装了节点 gem,但仍然收到相同的消息。