2017-05-03 57 views
9

這個問題已經在stackoverflow和其他論壇上被問了幾次,但我似乎無法通過我得到的這個錯誤。當我運行capistrano production deploy時,我將這個錯誤作爲部署過程的一部分。Json -v 1.8.6不會安裝作爲capistrano部署的一部分

cap production bundler:install 
00:00 bundler:install 
     01 bundle install --path /var/local/blackduck_flock_rails/shared/bundle --without development test --deployme… 
     01 An error occurred while installing json (1.8.6), and Bundler cannot continue. 
     01 Make sure that `gem install json -v '1.8.6'` succeeds before bundling. 
(Backtrace restricted to imported tasks) 
cap aborted! 


SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: bundle exit status: 5 
bundle stdout: An error occurred while installing json (1.8.6), and Bundler cannot continue. 
Make sure that `gem install json -v '1.8.6'` succeeds before bundling. 
bundle stderr: Nothing written 


Tasks: TOP => bundler:install 
(See full trace by running task with --trace) 

我已經看到了我的log/capistrano.log文件,這裏是我一直在尋找的麻煩拍攝的相關內容。

# Logfile created on 2017-05-03 14:42:16 -0400 by logger.rb/54072 


INFO --------------------------------------------------------------------------- 
    INFO START 2017-05-03 14:42:16 -0400 cap production bundler:install 
    INFO --------------------------------------------------------------------------- 
DEBUG [ec1d281e] Running if test ! -d /var/local/blackduck_flock_rails/current; then echo "Directory does not exist '/var/local/blackduck_flock_rails/current'" 1>&2; false; fi as [email protected] 
DEBUG [ec1d281e] Command: if test ! -d /var/local/blackduck_flock_rails/current; then echo "Directory does not exist '/var/local/blackduck_flock_rails/current'" 1>&2; false; fi 
DEBUG [ec1d281e] Finished in 0.328 seconds with exit status 0 (successful). 
DEBUG [4f633904] Running /usr/bin/env bundle check --path /var/local/blackduck_flock_rails/shared/bundle as [email protected] 
DEBUG [4f633904] Command: cd /var/local/blackduck_flock_rails/current && /usr/bin/env bundle check --path /var/local/blackduck_flock_rails/shared/bundle 
DEBUG [4f633904] Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. 
DEBUG [4f633904] The following gems are missing 
* json (1.8.6) 
* tzinfo (1.2.2) 
* activesupport (4.2.6) 

etc. etc.......... 


DEBUG [4f633904] * uglifier (3.0.4) 

DEBUG [4f633904] Install missing gems with `bundle install` 
DEBUG [4f633904] Finished in 0.179 seconds with exit status 1 (failed). 
    INFO [6c99e662] Running /usr/bin/env bundle install --path /var/local/blackduck_flock_rails/shared/bundle --without development test --deployment --quiet as [email protected] 
DEBUG [6c99e662] Command: cd /var/local/blackduck_flock_rails/current && /usr/bin/env bundle install --path /var/local/blackduck_flock_rails/shared/bundle --without development test --deployment --quiet 
DEBUG [6c99e662] An error occurred while installing json (1.8.6), and Bundler cannot continue. 
Make sure that `gem install json -v '1.8.6'` succeeds before bundling. 

所以首先要注意的是。日誌告訴我,bundler的運行版本已過時,我應該安裝最新的版本。這是我不明白的。在我開發的機器上,我有Bundler version 1.14.6。在我試圖部署到的目標服務器上,我也有Bundler version 1.14.6。我已經在兩臺機器上都確認過了,它們確實是一樣的。其次,我對開發機器和目標機器都有相同的ruby版本。紅寶石版本是2.2.5

其次,當我在目標服務器上運行gem list時,可以看到安裝了json 1.8.6

json (1.8.3, 1.8.1) 

什麼給?

最後,問題必須出現在目標機器/var/local/blackduck_flock_rails/shared/bundle的這個目錄中。在bundle目錄內,我有一個ruby文件夾,它具有1.9.12.2.0。這可能是問題的根源嗎?我被困在這個問題上,看起來這些問題總是與某個人的機器上某些特定的問題有關,而這些問題並不一定會被應用。幫助將不勝感激。

+0

用戶'serv-deployer'是否擁有目標目錄並具有寫權限? – DevJem

+0

*「我可以看到'json 1.8.6'已經安裝。」* ...不,不是,你只安裝了1.8.1和1.8.3版本的安裝?安裝時出現什麼錯誤? (你可能有一些系統依賴問題?) –

+0

同樣關於ruby'1.9.1'文件夾 - 這個*不應該成爲一個問題,因爲這些庫不會被ruby'2.2'使用。但是如果你不需要一些傳統軟件的老紅寶石版本,那麼爲了以防萬一,儘量刪除它的所有痕跡。 –

回答

3

最可能的原因是您缺少capistrano無法安裝的某些系統依賴項。

ssh到你的服務器,並嘗試安裝sudo apt-get install libgmp3-dev

如果它不會再次解決問題,ssh和運行gem install json -v '1.8.6',因爲它告訴你在上面發佈您從中得到這裏的錯誤消息。

+0

你好!嘗試解決方案後,我仍然遇到問題,我甚至試圖捆綁更新,但仍然是相同的。有任何想法嗎 ? – marman