ruby Bundler::GemfileNotFound 每当我尝试运行 bundle install

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17539636/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 06:03:46  来源:igfitidea点击:

Bundler::GemfileNotFound whenever I try to run bundle install

rubybundler

提问by Braiam

I'm working in kali-linux (a linux distro witch is the continuation of Back-Track, based in Ubuntu, just that now is based on Debian wheezy) for some penetration testing. Everything was working just fine, until I decided to update my systems tools. Now whenever I try to run a tool based on ruby, it trows me:

我在 kali-linux(一个 linux 发行版女巫是 Back-Track 的延续,基于 Ubuntu,现在基于 Debian wheezy)进行一些渗透测试。一切都很好,直到我决定更新我的系统工具。现在,每当我尝试运行基于 ruby​​ 的工具时,它都会告诉我:

Could not find gem 'ruby-progressbar (>= 1.1.0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.

I proceed to run bundle installbut then it comes with Bundler::GemfileNotFounderror.

我继续运行,bundle install但随后出现Bundler::GemfileNotFound错误。

Kali use by default ruby, for using gems. The software don't 'require' any other package but ruby seems not-fully-configured/installed for the problem at hand.

Kali 默认使用 ruby​​,用于使用 gems。该软件不“需要”任何其他软件包,但 ruby​​ 似乎没有完全配置/安装手头的问题。

$ ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [i486-linux]
$ rvm
bash: rvm: command not found
$ rbenv
bash: rbenv: command not found

采纳答案by Braiam

The problem was that for some weird motive Ruby didn't detected that bundlerwas installed, although the package manager says so.

问题是出于某种奇怪的动机,Ruby 没有检测到bundler已安装,尽管包管理器是这样说的。

$ apt-cache policy bundler
  bundler:
Installed: 1.3.5-2
Candidate: 1.3.5-2
$ bundle --version
Bundler::GemfileNotFound

I simply run gem install bundlerthen bundler installas root in the tool root path and everything works as charm.

gem install bundler然后我只是bundler install在工具根路径中以 root 身份运行,一切都充满魅力。

回答by Ajey

I faced the same problem when I was trying to bundle installwithout realizing that I was not in the project directory. Make sure you're in the current project directory.

当我在bundle install没有意识到我不在项目目录中的情况下尝试时,我遇到了同样的问题。确保您位于当前项目目录中。

回答by Sachin Singh

to avoid this error you should be at the root of your application and create GemFile and specify all gems needed in there, and run bundle install

为避免此错误,您应该位于应用程序的根目录并创建 GemFile 并在其中指定所需的所有 gem,然后运行 ​​bundle install

回答by Matt Dressel

Do you use rvmor rbenv? If so, make sure you are using a particular ruby version.

你用rvm还是rbenv?如果是这样,请确保您使用的是特定的 ruby​​ 版本。

For rvm, rvm listand look for an indication next to your ruby version. If the correct one is not listed, run rvm install x.y.z. If the correct one is not selected, run rvm use x.y.z

对于 rvm,rvm list并在您的 ruby​​ 版本旁边寻找指示。如果没有列出正确的,请运行rvm install x.y.z。如果没有选择正确的,运行rvm use x.y.z

If you want to segregate your gems for a given project, create a gemset. Otherwise, you should be good to go.

如果您想为给定项目隔离您的 gem,请创建一个gemset. 否则,你应该很高兴。

Run gem install bundler. You should not have to do this as sudo. This will install bundler in either the Default rvm gemset, or the selected gemset.

运行gem install bundler。您不必像 sudo 那样执行此操作。这将在默认 rvm gemset 或选定的 gemset 中安装 bundler。

Bundler should now be available and can be run using bundle. This is the same as bundle install.

Bundler 现在应该可用并且可以使用bundle. 这与bundle install.

回答by Ligemer

Try this:

尝试这个:

sudo ln -s /var/lib/gems/1.8/bin/bundle /bin/bundle
sudo ln -s /var/lib/gems/1.8/bin/bundler /bin/bundler

Worked for me in debian.

在 debian 中对我来说有效。