我能够成功运行 gem install bundler,但仍然得到“无法找到‘bundler’”

问题描述 投票:0回答:1

设置我运行 ventura 13.4.1 的旧英特尔苹果笔记本电脑,尝试使用 ruby-3.1.3 从头开始创建一个全新的 Rails 7 应用程序。我下载了最新的命令行工具。我跑

gem install bundler --version 2.3.26 --default
然后我得到了

Successfully installed bundler-2.3.26 as a default gem

然后是下一行

ERROR:  While executing gem ... (Errno::ENOENT)
    No such file or directory @ dir_chdir - /usr/local/lib/ruby/gems/3.2.0/specifications/gems/bundler-2.3.26

我跑

gem install bundler
然后我得到了

Successfully installed bundler-2.4.19
Parsing documentation for bundler-2.4.19
Done installing documentation for bundler after 0 seconds
1 gem installed

我跑

gem list bundler
然后我得到了

*** LOCAL GEMS ***

bundler (2.4.19, 2.3.26)

我跑步

bundler -v
我明白了

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.3.26) required by your /Users/kendallcarey/repos/broadway-blog/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.3.26`

我已经尝试运行

gem install bundler:2.3.26
很多次,这是我的Gemfile.lock中的版本。我什至运行了
gem update --system
,但没有任何改变。我怎样才能让
bundle install
上班?

ruby-on-rails ruby rubygems bundler
1个回答
0
投票

原来是ruby版本。我能够在运行服务器的选项卡上运行捆绑安装,并且新选项卡使用不同版本的 ruby。

© www.soinside.com 2019 - 2024. All rights reserved.