2016-07-06 83 views
2

我想将rails应用程序部署到AWS弹性beanstalk。每次我尝试部署时,都会收到此错误消息。我发现一个答案,说增加实例大小来处理内存异常,但它没有为我工作。我的项目最初部署到不同的AWS账户,但没有问题,但现在我试图切换帐户,它不起作用。有没有人知道这个解决方案?红宝石无法在Elastic Beanstalk上安装

Installing json 1.8.3 with native extensions 

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

     /opt/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160706-28984-2z7sxy.rb extconf.rb 
    Cannot allocate memory - /opt/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160706-28984-2z7sxy.rb extco 
nf.rb 2>&1 

    Gem files will remain installed in /opt/rubies/ruby-2.2.5/lib/ruby/gems/2.2.0/gems/json-1.8.3 for in 
spection. 
    Results logged to /opt/rubies/ruby-2.2.5/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0-static/js 
on-1.8.3/gem_make.out 
    Using minitest 5.9.0 
    Using thread_safe 0.3.5 
    Using builder 3.2.2 
    Using erubis 2.7.0 
    Using mini_portile2 2.1.0 
    Using pkg-config 1.1.7 
    Using rack 1.6.4 
    Using mime-types-data 3.2016.0521 
    Using arel 6.0.3 
    Using execjs 2.7.0 
    Installing bcrypt 3.1.10 with native extensions 

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

     /opt/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160706-28984-omunxa.rb extconf.rb 
    Cannot allocate memory - /opt/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160706-28984-omunxa.rb extconf.rb 2>&1 

    Gem files will remain installed in /opt/rubies/ruby-2.2.5/lib/ruby/gems/2.2.0/gems/bcrypt-3.1.10 for inspection. 
    Results logged to /opt/rubies/ruby-2.2.5/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0-static/bcrypt-3.1.10/gem_make.out 
    Using sass 3.4.22 
    Using coffee-script-source 1.10.0 
    Using thor 0.19.1 
    Using concurrent-ruby 1.0.2 
    Using multi_json 1.12.1 
    Installing puma 3.4.0 with native extensions 

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

     /opt/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160706-28984-tifyar.rb extconf.rb 
    Cannot allocate memory - /opt/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160706-28984-tifyar.rb extconf.rb 2>&1 

    Gem files will remain installed in /opt/rubies/ruby-2.2.5/lib/ruby/gems/2.2.0/gems/puma-3.4.0 for inspection. 
    Results logged to /opt/rubies/ruby-2.2.5/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0-static/puma-3.4.0/gem_make.out 
    Using bundler 1.12.1 
    Using tilt 2.0.5 
    Installing sqlite3 1.3.11 with native extensions 

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

     /opt/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160706-28984-2xtic2.rb extconf.rb 
    Cannot allocate memory - /opt/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160706-28984-2xtic2.rb extconf.rb 2>&1 

    Gem files will remain installed in /opt/rubies/ruby-2.2.5/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.11 for inspection. 
    Results logged to /opt/rubies/ruby-2.2.5/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0-static/sqlite3-1.3.11/gem_make.out 
    An error occurred while installing json (1.8.3), and Bundler cannot continue. 
    Make sure that `gem install json -v '1.8.3'` succeeds before bundling. (Executor::NonZeroExitStatus) 

UPDATE

我能对这个项目成功部署到原来的AWS帐号这是对,但仍不能在我想

+0

安装第一个“sudo apt-get install libgmp3-dev”然后试试? – error2007s

回答

0

该错误的帐户部署它是因为你的服务器RAM内存不足。你可以去你的服务器,找到什么在泄漏内存并杀死它,添加一些交换或尝试手动或手动安装gem,因为部署过程消耗更多的内存。

-1

你可以用两种方法解决这个问题。

1)创建ebextension文件类型选项下面

option_settings: 
    - option_name: BUNDLE_DISABLE_SHARED_GEMS 
    value: "1" 
    - option_name: BUNDLE_PATH 
    value: "vendor/bundle" 

2)连接到使用ssh服务器,转到在/ var /应用/电流和类型捆绑安装的命令,并尝试部署应用程序。

+0

我尝试了这两种方法,但都没有奏效。当我使用ssh时,我只能在/ var/app/ondeck中找到我的rails应用程序,当前文件夹是空的。我也试图单独安装所有失败的宝石。 –

+0

我认为你的服务器会很繁忙,请检查实例日志或eb日志。如果日志文件中没有任何错误,则尝试运行命令包install --path vendor/bundle – Pratap