我 git 克隆了我自己的 repo,當我想啟動 (rails s) 時,即使我安裝了它,也會有安裝 Rails 的請求 (sudo apt install ruby??-railties)。如果我開始安裝(gem install rails),會出現Ruby版本太舊的提示:
ERROR: Error installing rails:
There are no versions of activesupport (= 7.0.0) compatible with your Ruby & RubyGems. Maybe try installing an older version of the gem you're looking for?
activesupport requires Ruby version >= 2.7.0. The current ruby ??version is 2.6.6.146.
如果我切換到請求的版本(rvm 使用 2.7),當我運行 rails s 時會出現以下訊息:
Could not find proper version of railties (6.1.4.1) in any of the sources
Run `bundle install` to install missing gems.
當我進行 bundle install 時,需要切換 Ruby 版本:
Your Ruby version is 2.7.2, but your Gemfile specified 2.6.6
這相當于回到了起點。這個愚蠢的回圈使我無法完成捆綁安裝,因此無法完成 rails s。
uj5u.com熱心網友回復:
關于 pg 錯誤,您需要將“pg” gem 更改為較低版本。讓我們看看您的 gemfile 中有什么。
uj5u.com熱心網友回復:
在專案檔案夾中設定環境。
cd yourproject
然后安裝 Ruby、Rails 和 Bundler。
通過 Ruby 版本管理器 (RVM) https://rvm.io/安裝 Ruby v2.7.0
gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
rvm install ruby 2.7.0
rvm use 2.7.0
rvm list
通過 RubyGems https://rubygems.org安裝 Rails
(不要使用apt install ruby-railties)
gem install rails
rails --version
(重新)安裝捆綁程式
gem install bundler
bundle install
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/394453.html
標籤:红宝石轨道 红宝石 PostgreSQL的
