今天開發過程當中,從master拉下代碼後重啓項目,想用控制檯時,卻發現須要密碼??而且三次密碼確認後仍是瘋狂報錯。shell
當時第一想到是rvm版本不一致,隨即則檢查了版本跟gem生成,當確認rvm版本無誤時,且強制使用sudo安裝卻須要一條條執行gem install ***安裝gem包時,就令我抓狂了。ruby
警告提示以下:bash
Your user account isn't allowed to install to the system RubyGems. You can cancel this installation and run: bundle install --path vendor/bundle to install the gems into ./vendor/bundle/, or you can enter your password and install the bundled gems to RubyGems using sudo.
或者以下:ui
RVM is not a function, selecting rubies with 'rvm use ...' will not work. You need to change your terminal emulator preferences to allow login shell. Sometimes it is required to use `/bin/bash --login` as the command. Please visit https://rvm.io/integration/gnome-terminal/ for an example.
猜想緣由:this
rbenv 要往你係統的自帶Ruby裏面安裝gem,可是你的用戶賬戶不容許系統安裝RubyGems,因此要你輸入密碼賦予權限spa
解決方案(控制檯依次輸入):code
1 echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"' >>~/.bashrc 2 3 source ~/.bashrc 4 5 ruby -v
而後就解決了,能夠繼續嗨皮開發了!!blog