2016-07-06 82 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