Ruby-on-rails “找不到捆绑器”错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6166081/
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-03 01:16:09  来源:igfitidea点击:

"Could not find bundler" error

ruby-on-railsrubyrakebundler

提问by Steven

When I try to do bundler updateI get this error:

当我尝试这样做时,bundler update我收到此错误:

.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in
`to_specs': Could not find bundler (>= 0) amongst
[rake-0.8.7, rake-0.8.7, rubygems-update-1.8.4] (Gem::LoadError)

I'm new to Ruby, can someone tell me what would cause this? Rake 0.8.7 is installed.

我是 Ruby 的新手,有人能告诉我是什么原因造成的吗?安装了 Rake 0.8.7。

回答by ardavis

Make sure you're entering "bundle" update, if you have the bundler gem installed.

如果您安装了 bundler gem,请确保您正在输入“bundle”更新。

bundle update

bundle update

If you don't have bundler installed, do gem install bundler.

如果您没有安装 bundler,请执行gem install bundler.

回答by Dorian

I had this problem, then I did:

我遇到了这个问题,然后我做了:

gem install bundle

notice "bundle" not "bundler" solved my problem.

注意“捆绑”而不是“捆绑”解决了我的问题。

then in your project folder do:

然后在您的项目文件夹中执行以下操作:

bundle install

and then you can run your project using:

然后您可以使用以下方法运行您的项目:

script/rails server

回答by bjelli

I had the same problem. This worked for me:

我有同样的问题。这对我有用:

  1. run rvm/script/rvm and also add it to your .profile or .bash_profile as shown in https://rvm.io/rvm/install/

  2. use bundle without sudo

  1. 运行 rvm/script/rvm 并将其添加到您的 .profile 或 .bash_profile 中,如https://rvm.io/rvm/install/所示

  2. 使用没有 sudo 的包

回答by Andrew Khouzam

If You are using rvm, then try the following command:

如果您使用的是 rvm,请尝试以下命令:

rvmsudo gem install bundler

According to another question: Could not find rails (>= 0) amongst [] (Gem::LoadError)

根据另一个问题:在 [] (Gem::LoadError) 中找不到 rails (>= 0)

Hope it helped, Cheers

希望它有所帮助,干杯

回答by Zabba

The command is bundle update(there is no "r" in the "bundle").

命令是bundle update(“包”中没有“r”)。

To check if bundler is installed do : gem list bundleror even which bundleand the command will list either the bundler version or the path to it. If nothing is shown, then install bundler by typing gem install bundler.

要检查是否安装了 bundler,请执行 :gem list bundler或 evenwhich bundle命令,该命令将列出 bundler 版本或它的路径。如果未显示任何内容,请键入gem install bundler.

回答by Brian Vitrue

I had the same problem .. something happened to my bash profile that wasn't setting up the RVM stuff correctly.

我遇到了同样的问题……我的 bash 配置文件发生了一些问题,没有正确设置 RVM 内容。

Make sure your bash profile has the following line:

确保您的 bash 配置文件包含以下行:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.

Then I ran "source ~/.bash_profile" and that reloaded everything that was in my bash profile.

然后我运行“source ~/.bash_profile”并重新加载了我的 bash 配置文件中的所有内容。

That seemed to fix it for me.

这似乎为我解决了这个问题。

回答by Andrew Khouzam

According to this answerto a similar question, it should be enough:

按照这个答案到类似的问题,它应该是足够了:

rvmsudo gem install bundler.

Cheers

干杯

回答by mgauthier

You may have to do something like "rvm use 1.9.2" first so that you are using the correct ruby and gemset. You can check which ruby you are using by doing "which ruby"

您可能必须先执行诸如“rvm use 1.9.2”之类的操作,以便使用正确的 ruby​​ 和 gemset。您可以通过执行“which ruby​​”来检查您正在使用哪种 ruby

回答by Thomas Leonard

I got this after upgrading to ruby 2.1.0. My PATHwas set in my login script to include .gem/ruby/2.0.0/bin. Updating the version number fixed it.

升级到 ruby​​ 2.1.0 后我得到了这个。我PATH在我的登录脚本中设置为包含.gem/ruby/2.0.0/bin. 更新版本号修复了它。

回答by Bogdan Ustyak

The system might be running "rootless". Try to set the firmware nvram variable boot-args to "rootless=0". Try to run set of commands:

系统可能正在“无根”运行。尝试将固件 nvram 变量 boot-args 设置为“rootless=0”。尝试运行一组命令:

sudo nvram boot-args="rootless=0"; 
sudo reboot

After reboot completes, run:

重启完成后,运行:

sudo gem install bundler