在 windows 上安装 gem http_parser

install gem http_parser on windows

我正在处理项目 Symfony 和 Bootstrap 4 我想使用源 bootstrap。为此,我需要 ruby 和所有捆绑包。

我启动这个命令 : bundler install 我在 http_parser.rb (0.6.0)

上安装时出错

我启动这个命令 : gem install http_parser.rb --source 'http://rubygems.org/' --install-dir '/dev/tmp/http'

但我有这个错误:C:/dev/Ruby24-x64/lib/ruby/gems/2.4.0/gems/make-0.3.1/bin/make:4:in': undefined local variable or method make' for main:Object (NameError) from C:/dev/Ruby24-x64/bin/make:22:inload' 来自 C:/dev/Ruby24-x64/bin/make:22:in <main>'

所以我用安装了make工具:gem install make Successfully installed make-0.3.1 Parsing documentation for make-0.3.1 Done installing documentation for make after 0 seconds 1 gem installed

然后我重试安装 http_parser 和 : gem install http_parser.rb --source 'http://rubygems.org/' --install-dir '/dev/tmp/http'

但没有任何变化。我再次出现此错误:C:/dev/Ruby24-x64/lib/ruby/gems/2.4.0/gems/make-0.3.1/bin/make:4:in `<top (required)>': undefined local variable or method `make' for main:Object (NameError) from C:/dev/Ruby24-x64/bin/make:22:in `load' from C:/dev/Ruby24-x64/bin/make:22:in `<main>'

如何在 windows OS 上安装 http_parser gem?

为什么 make 不 运行 正确但安装正确?

该错误表明 Ruby 需要编译本机(非 Ruby)代码才能安装和使用 http_parser gem。

要在 Windows 上编译本机代码,您需要使用 DevKit 包安装 Ruby。如果您使用 RubyInstaller,您只需选择 Ruby+DevKit 包而不是普通的 Ruby 包。这应该允许 http_parser 安装完成。