我在一台Mac M1上,我用罗塞塔安装了红宝石,它工作了很长一段时间。我不得不重新安装啤酒,因为其他原因,并利用机会安装它只是在ARM。我安装了ruby3.1.2来使用rbenv运行外部proyect,但是rails没有识别它。
当我运行rbenv时:
> rbenv version
3.1.2 (set by /Users/vicente/.rbenv/version)如果我经营红宝石:
> ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]但是当我运行rails时:
> rails s
Ignoring nokogiri-1.13.8 because its extensions are not built. Try: gem pristine nokogiri --version 1.13.8
Ignoring nokogiri-1.13.8 because its extensions are not built. Try: gem pristine nokogiri --version 1.13.8
Ignoring racc-1.6.0 because its extensions are not built. Try: gem pristine racc --version 1.6.0
Ignoring racc-1.5.2 because its extensions are not built. Try: gem pristine racc --version 1.5.2
.... It repeats similar warnings A LOT ...
Your Ruby version is 2.6.8, but your Gemfile specified 3.1.2如果我运行rails new app,它也会显示相同的消息。
当我在proyect之外运行rails时,它会抛出相同的警告,如下所示:
> rails
Rails 7 requires Ruby 2.7.0 or newer.
You're running
ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]
Please upgrade to Ruby 2.7.0 or newer to continue.我已经尝试过使用sudo gem pristine — all并重新安装rails。
编辑:
如果我运行哪条rails:
> which rails
/usr/local/bin/rails此外,当我在proyect文件夹中运行bundle安装时,它似乎工作得很好:
> bundle install
Using rake 13.0.6
Using concurrent-ruby 1.1.10
... Bunch of other gems ...
Bundle complete! 22 Gemfile dependencies, 105 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.编辑2:
我运行过rbenv rehash,但没有改变。
发布于 2022-10-15 09:43:05
使用您需要的版本创建一个..ruby版本文件:示例:
.红宝石版
3.1.2还要确保默认版本与指定的版本相匹配。
试着让gem install rails
https://stackoverflow.com/questions/74075277
复制相似问题