我使用sudo捆绑安装,这可能是问题的原因?
现在我有:
Gem -v 2.6.14
Ruby -v Ruby 2.3.5p376 (2017-09-14 revision 59905) [x86_64-darwin15]
Jekyll -v Jekyll 3.6.2
vbundler版本为1.16.0.pre.3
我得到以下错误时,试图运行捆绑执行jekyll服务或只是jekyll服务
/Users/myusername/.rvm/rubies/ruby-2.3.5/lib/ruby/site_ruby/2.3.0/rubygems.rb:271:in `find_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException)
from /Users/myusername/.rvm/rubies/ruby-2.3.5/lib/ruby/site_ruby/2.3.0/rubygems.rb:299:in `activate_bin_path'
from /Users/myusername/.rvm/gems/ruby-2.3.5/bin/bundle:23:in `<main>'
from /Users/myusername/.rvm/gems/ruby-2.3.5/bin/ruby_executable_hooks:15:in `eval'
from /Users/myusername/.rvm/gems/ruby-2.3.5/bin/ruby_executable_hooks:15:in `<MacBooMacBook-MacBook-MacBook-Pro-MacBook-PrMacBook-MacBooMacBMaMacBMaMaMaMaMaMaMaMaMacBMaMaMaMacBMa
同样,当访问我的博客cd my_path所在的文件夹时,我得到以下消息:
VM使用你的Gemfile来选择Ruby,这一切都很好- Heroku也这样做,
你可以通过'rvm rvmrc warning ignore /Library/WebServer/Documents/blog/Gemfile'忽略这些警告。
要忽略所有文件的警告,请执行'rvm rvmrc warning ignore allGemfiles'命令。
未知ruby解释器版本(不知道如何处理):RUBY_VERSION。
我不知道该怎么解决。我只是想创建我的静态博客,老实说,我不知道Ruby, Gem或Bundle:)所以我很感激一些见解!
更新:
根据@noraj的回答和@Niels Kristian的评论,下面的命令应该可以完成这项工作。
gem update --system
bundle install
我写这个是为了防止有人遇到我这样的问题。
宝石安装捆绑器显示,一切安装良好。
Fetching: bundler-1.16.0.gem (100%)
Successfully installed bundler-1.16.0
Parsing documentation for bundler-1.16.0
Installing ri documentation for bundler-1.16.0
Done installing documentation for bundler after 7 seconds
1 gem installed
当我输入bundle时,有一个错误:
/Users/nikkov/.rvm/gems/ruby-2.4.0/bin/bundle:23:in `load': cannot load such file -- /Users/nikkov/.rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/exe/bundle (LoadError)
from /Users/nikkov/.rvm/gems/ruby-2.4.0/bin/bundle:23:in `<main>'
from /Users/nikkov/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
from /Users/nikkov/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'
在/Users/nikkov/.rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/文件夹中没有bunder -1.16.0文件夹。
我用sudo宝石安装捆绑器修复了这个问题
真正的答案在这里,如果你试图安装bundler 2.0.1或2.0.0,因为bundler需要RubyGems v3.0.0
Yesterday I released Bundler 2.0 that introduced a number of breaking changes. One of the those changes was setting Bundler to require RubyGems v3.0.0. After making the release, it has become clear that lots of our users are running into issues with Bundler 2 requiring a really new version of RubyGems.
We have been listening closely to feedback from users and have decided to relax the RubyGems requirement to v2.5.0 at minimum. We have released a new Bundler version, v2.0.1, that adjusts this requirement.
更多信息,请参见:https://bundler.io/blog/2019/01/04/an-update-on-the-bundler-2-release.html
在我的情况下,上述建议对我不起作用。我的情况有点不同。
当我尝试使用gem安装bundle安装bundle ..但我正在
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
然后我尝试使用sudo宝石安装捆绑器,然后我得到
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
然后我尝试用sudo gem安装捆绑器-n /usr/local/bin(只是/usr/bin力在我的情况下工作)。
然后成功安装了捆扎机
编辑:我使用MacOS,也许/usr/bin不适合我的原因(https://stackoverflow.com/a/34989655/3786657评论)