即使刚刚安装也找不到google protobuf gem

问题描述 投票:0回答:1

首先,我没有使用系统ruby,我使用的是新安装的,因为Mac OS上的系统ruby存在很多问题。

which ruby
which gem
都显示它们使用相同的 ruby

我正在尝试运行 Jekyll 服务,但捆绑包找不到 google protobuf。我尝试了

bundle install
gem install google-protobuf
但没有任何效果。终端输出如下所示:

username@MBP repo % gem install google-protobuf
Building native extensions. This could take a while...
Successfully installed google-protobuf-3.25.2
Parsing documentation for google-protobuf-3.25.2
Done installing documentation for google-protobuf after 0 seconds
1 gem installed

username@MBP repo % bundle info google-protobuf-3.25.2   
Could not find gem 'google-protobuf-3.25.2'.

username@MBP repo % bundle exec jekyll serve             
Could not find google-protobuf-3.25.2 in locally installed gems
Run `bundle install` to install missing gems.

username@MBP repo % jekyll server                        
Ignoring google-protobuf-3.25.2 because its extensions are not built. Try: gem pristine google-protobuf --version 3.25.2
Ignoring google-protobuf-3.25.2 because its extensions are not built. Try: gem pristine google-protobuf --version 3.25.2
/Users/jakobimuller/.gem/ruby/3.1.3/gems/bundler-2.5.3/lib/bundler/definition.rb:570:in `materialize': Could not find google-protobuf-3.25.2 in locally installed gems (Bundler::GemNotFound)
    from /Users/jakobimuller/.gem/ruby/3.1.3/gems/bundler-2.5.3/lib/bundler/definition.rb:203:in `specs'
    from /Users/jakobimuller/.gem/ruby/3.1.3/gems/bundler-2.5.3/lib/bundler/definition.rb:270:in `specs_for'
    from /Users/jakobimuller/.gem/ruby/3.1.3/gems/bundler-2.5.3/lib/bundler/runtime.rb:18:in `setup'
    from /Users/jakobimuller/.gem/ruby/3.1.3/gems/bundler-2.5.3/lib/bundler.rb:162:in `setup'
    from /Users/jakobimuller/.gem/ruby/3.1.3/gems/jekyll-4.3.3/lib/jekyll/plugin_manager.rb:52:in `require_from_bundler'
    from /Users/jakobimuller/.gem/ruby/3.1.3/gems/jekyll-4.3.3/exe/jekyll:11:in `<top (required)>'
    from /Users/jakobimuller/.gem/ruby/3.1.3/bin/jekyll:25:in `load'
    from /Users/jakobimuller/.gem/ruby/3.1.3/bin/jekyll:25:in `<main>'

我尝试使用脚本、

bundle install
gem install
安装它,但没有正确安装它,导致我无法执行
Jekyll serve

ruby rubygems protocol-buffers jekyll bundle
1个回答
0
投票

gem 'google-protobuf'
添加到您的 Gemfile 并运行
bundle install

© www.soinside.com 2019 - 2024. All rights reserved.