2017-05-03 51 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