2016-10-18 36 views
1

我有一個登臺服務器。我想在那裏調查一些問題。但我忘了將byebug添加到Gemfile。我肯定可以在本地添加它,運行bundle,提交到存儲庫,部署。但是有沒有更簡單的方法?如何在生產環境中使用捆綁器安裝其他gem?

當我嘗試用遙控改變Gemfile和運行bundle我得到:

You are trying to install in deployment mode after changing 
your Gemfile. Run `bundle install` elsewhere and add the 
updated Gemfile.lock to version control. 

If this is a development machine, remove the /home/gccs/website-backend/releases/20161018143057/Gemfile freeze 
by running `bundle install --no-deployment`. 

You have added to the Gemfile: 
* byebug 

寶石都安裝了capistrano,基本上,像這樣:

bundle install --path /home/user/app/shared/bundle --without development test --deployment --quiet 

回答

1

編輯.bundle/config改變BUNDLE_FROZEN: '1''0'(或刪除它)就足以讓Bundler允許在部署環境中管理寶石。然後,您可以編輯Gemfile,運行bundle,重新啓動您的應用程序,並且可以使用自定義寶石。

如果您打算在應用程序運行時之外使用它們(如果您需要pry,rails console),則不需要重新啓動服務器。

+0

我增加了更多信息的問題。我可以說,'bundler'與'Gemfile.local'產生相同的錯誤信息。 –

+1

你需要編輯'.bundle/config'並刪除這一行:'BUNDLE_FROZEN:'1''。這開始變得比提交,推送和部署更復雜;) – mdesantis

+1

'您需要編輯.bundle/config並刪除這一行:BUNDLE_FROZEN:'1''或者只是將其更改爲'0'。無論如何,偉大的,它的工作,謝謝。 '這已經開始變得比提交,推送和部署更復雜了,嗯,根本不需要,你只需要「解凍」改變'Gemfile',更改'Gemfile',並運行'bundle'。不需要'Gemfile.local'。請考慮更新您的答案。 –

1

您無法安裝其他寶石的原因是因爲該包已凍結。你可以檢查它像這樣:

$ grep FROZEN .bundle/config 
BUNDLE_FROZEN: '1' 

如果去掉線(由mdesantis的建議),或改變「1」到「0」時,你就可以安裝任何你喜歡的寶石,彷彿它是開發者機器。但通常最好是恢復價值,如果不再需要的話。不確定bundler是否會在下次部署時自動執行此操作。

相關問題