Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails can';找不到宝石绑定器Ruby_Ruby On Rails_Ruby - Fatal编程技术网

Ruby on rails can';找不到宝石绑定器Ruby

Ruby on rails can';找不到宝石绑定器Ruby,ruby-on-rails,ruby,Ruby On Rails,Ruby,使用MacOS13,rbenv ruby 2.5.0p0(2017-12-25修订版61468)[x86_64-darwin17] 轨道5.1.4 捆绑程序版本1.16.1 rbenv 1.1.1 我正在尝试启动一个新的Rails应用程序,然后得到以下结果: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:241:in `bin_path': can't find gem

使用MacOS13,rbenv

ruby 2.5.0p0(2017-12-25修订版61468)[x86_64-darwin17]

轨道5.1.4

捆绑程序版本1.16.1

rbenv 1.1.1

我正在尝试启动一个新的Rails应用程序,然后得到以下结果:

/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:241:in `bin_path': can't find gem bundler (>= 0) (Gem::GemNotFoundException)
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/generators/app_base.rb:382:in `bundle_command'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/generators/app_base.rb:416:in `run_bundle'
from (eval):1:in `run_bundle'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `block in invoke_all'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `each'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `map'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `invoke_all'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/group.rb:232:in `dispatch'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/application/application_command.rb:24:in `perform'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/cli.rb:16:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/exe/rails:9:in `<top (required)>'
from /usr/local/bin/rails:22:in `load'
from /usr/local/bin/rails:22:in `<main>'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/Ruby/2.3.0/rubygems.rb:241:在“bin_路径”中:找不到gem绑定器(>=0)(gem::GemNotFoundException)
from/Library/Ruby/Gems/2.3.0/Gems/railties-5.1.4/lib/rails/generators/app_base.rb:382:in'bundle_command'
from/Library/Ruby/Gems/2.3.0/Gems/railties-5.1.4/lib/rails/generators/app_base.rb:416:in'run_bundle'
from(eval):1:in'run_bundle'
from/Library/Ruby/Gems/2.3.0/Gems/thor-0.20.0/lib/thor/command.rb:27:in'run'
from/Library/Ruby/Gems/2.3.0/Gems/thor-0.20.0/lib/thor/invocation.rb:126:in'invoke_命令'
from/Library/Ruby/Gems/2.3.0/Gems/thor-0.20.0/lib/thor/invocation.rb:133:in'block in invoke_all'
from/Library/Ruby/Gems/2.3.0/Gems/thor-0.20.0/lib/thor/invocation.rb:133:in'each'
from/Library/Ruby/Gems/2.3.0/Gems/thor-0.20.0/lib/thor/invocation.rb:133:in'map'
from/Library/Ruby/Gems/2.3.0/Gems/thor-0.20.0/lib/thor/invocation.rb:133:in'invoke_all'
from/Library/Ruby/Gems/2.3.0/Gems/thor-0.20.0/lib/thor/group.rb:232:in'dispatch'
from/Library/Ruby/Gems/2.3.0/Gems/thor-0.20.0/lib/thor/base.rb:466:in'start'
from/Library/Ruby/Gems/2.3.0/Gems/railties-5.1.4/lib/rails/commands/application/application_command.rb:24:in'perform'
from/Library/Ruby/Gems/2.3.0/Gems/thor-0.20.0/lib/thor/command.rb:27:in'run'
from/Library/Ruby/Gems/2.3.0/Gems/thor-0.20.0/lib/thor/invocation.rb:126:in'invoke_命令'
from/Library/Ruby/Gems/2.3.0/Gems/thor-0.20.0/lib/thor.rb:387:in'dispatch'
from/Library/Ruby/Gems/2.3.0/Gems/railties-5.1.4/lib/rails/command/base.rb:63:in'perform'
from/Library/Ruby/Gems/2.3.0/Gems/railties-5.1.4/lib/rails/command.rb:44:in'invoke'
from/Library/Ruby/Gems/2.3.0/Gems/railties-5.1.4/lib/rails/cli.rb:16:in`'
from/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/Ruby/2.3.0/rubygems/core\u ext/kernel\u require.rb:127:in'require'
from/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/Ruby/2.3.0/rubygems/core\u ext/kernel\u require.rb:127:in“rescue in require”
from/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/Ruby/2.3.0/rubygems/core\u ext/kernel\u require.rb:40:in'require'
from/Library/Ruby/Gems/2.3.0/Gems/railties-5.1.4/exe/rails:9:in`'
from/usr/local/bin/rails:22:in'load'
from/usr/local/bin/rails:22:in`'

据我所知,它与Ruby版本有关,但我不知道如何解决这个问题。

看起来您可能需要执行
gem安装bundler
并让bundler gem启动并运行rails。

步骤(1):安装bundler gem:

sudo gem install bundler
完成后,您将收到类似于以下内容的消息:

Fetching: bundler-1.16.1.gem (100%)
Successfully installed bundler-1.16.1
Parsing documentation for bundler-1.16.1
Installing ri documentation for bundler-1.16.1
Done installing documentation for bundler after 6 seconds
1 gem installed
步骤(2):尝试检查捆绑程序版本:

bundle -v
您应该获得如下版本号:

Bundler version 1.16.1
步骤(3):现在您可以使用bundle安装:

bundle install

我希望我的回答能有所帮助。

添加导致问题出错的命令Ruby 2.5在默认情况下会包括bundler gem,但在最后一分钟他们取消了它。所以现在,我们仍然需要在新的Ruby 2.5安装上执行
gem安装bundler
,然后才能执行
bundle安装
。顺便说一句,看起来您正在使用您的系统Ruby。您应该强烈地考虑使用Ruby环境管理器,比如“添加错误的命令”“我运行<代码> Rails新app Ap/代码>是的,我做了<代码> GEM安装Buffer-<代码>,我用RBEV安装了Ruby 2.5.0。你安装Ruby 2.3了吗?我怀疑ruby 2.5不是当前的默认版本。看起来它仍然可以访问2.3版:从/System/Library/Frameworks/Ruby.framework/Versions/2.3/Oh,我做了,但没有帮助。很高兴知道!如果你把你已经尝试过的事情的一些解决方案(和结果)包括在内,这会很有帮助。另外,@moveson推荐了一个版本控制/env管理器,比如rbenv或rvm,这非常有用。对不起,我应该这么说。我的错。到目前为止,我已经尝试了
gem安装bundler
,并且使用了rbenv。就这些,不用担心。在使用rbenv之前,您是否安装过ruby?如果运行
哪个捆绑包
,路径是什么?我刚刚重新安装了所有东西,现在就可以工作了。谢谢你的帮助。也许问题是我安装了Rails,之后又安装了新的Ruby版本的rbenv。永远不要使用sudo安装。@IulianOnofrei如果你说明了原因,而不仅仅是发出命令,你的评论会更有用。非常感谢。