安装“jekyll”后无法使用“vagrant”,错误为“找不到 gem vagrant”

安装“jekyll”后无法使用“vagrant”,错误为“找不到 gem vagrant”

安装后gem install jekyll我的命令失败,显示:

$ vagrant up
/usr/lib/ruby/vendor_ruby/rubygems.rb:265:in `find_spec_for_exe': can't find gem vagrant (>= 0.a) with executable vagrant (Gem::GemNotFoundException)
    from /usr/lib/ruby/vendor_ruby/rubygems.rb:284:in `activate_bin_path'
    from /usr/bin/vagrant:25:in `<main>'
/usr/lib/ruby/vendor_ruby/rubygems.rb:265:in `find_spec_for_exe': can't find gem vagrant (>= 0.a) with executable vagrant (Gem::GemNotFoundException)
    from /usr/lib/ruby/vendor_ruby/rubygems.rb:284:in `activate_bin_path'
    from /usr/bin/vagrant:25:in `<main>'
/usr/lib/ruby/vendor_ruby/rubygems.rb:265:in `find_spec_for_exe': can't find gem vagrant (>= 0.a) with executable vagrant (Gem::GemNotFoundException)
    from /usr/lib/ruby/vendor_ruby/rubygems.rb:284:in `activate_bin_path'
    from /usr/bin/vagrant:25:in `<main>'
/usr/lib/ruby/vendor_ruby/rubygems.rb:265:in `find_spec_for_exe': can't find gem vagrant (>= 0.a) with executable vagrant (Gem::GemNotFoundException)
    from /usr/lib/ruby/vendor_ruby/rubygems.rb:284:in `activate_bin_path'
    from /usr/bin/vagrant:25:in `<main>'
$ LANG=C dpkg -l vagrant
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version              Architecture Description
+++-==============-====================-============-==========================================================>
ii  vagrant        2.2.19+dfsg-1ubuntu1 all      Tool for building and distributing virtualized development>

我需要一个临时的解决方法(变量在中声明~/.bashrc):

$ unset GEM_HOME GEM_PATH

现在,我可以运行了vagrant。有什么明确的解决方案可以避免此类问题?

答案1

解决方案是删除

export GEM_PATH=$HOME/gems # to remove

这已经足够了:

export GEM_HOME="$HOME/gems"
export PATH=PATH=~/gems/bin:$PATH

相关内容