簡體   English   中英

安裝unf_ext時,Bundle安裝失敗。 “安裝unf_ext時無法分配內存錯誤”

[英]Bundle install fails when install unf_ext. “Cannot allocate memory error when installing unf_ext”

我在遠程服務器上發生了這個錯誤。

雖然這在我的本地環境中無法復制。

使用本機擴展安裝unf_ext 0.0.7.2

Gem :: Ext :: BuildError:錯誤:無法構建gem原生擴展。

/home/ubuntu/.rbenv/versions/2.1.2/bin/ruby extconf.rb

無法分配內存 - /home/ubuntu/.rbenv/versions/2.1.2/bin/ruby extconf.rb 2>&1

Gem files will remain installed in /home/ubuntu/switch-web/shared/bundle/ruby/2.1.0/gems/unf_ext-0.0.7.2 for inspection.
Results logged to /home/ubuntu/switch-web/shared/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/unf_ext-0.0.7.2/gem_make.out
An error occurred while installing unf_ext (0.0.7.2), and Bundler cannot
continue.
Make sure that `gem install unf_ext -v '0.0.7.2'` succeeds before bundling.

我已經檢查了我的服務器的ram空間,它仍然相當不錯(2gb免費)。

我通過升級服務器來修復此問題,增加了內存。

很老的問題,但我可以建議一個替代的答案。 如果服務器沒有交換分區,您可以臨時創建並啟用交換文件,而不是升級服務器資源(可能還有成本):

以root身份運行:

# create a 512 Mb file
dd if=/dev/zero of=/swapfile1 bs=1024 count=524288

# assign the correct permissions
chown root:root /swapfile1
chmod 0600 /swapfile1

# initialize the file as a swap file
mkswap /swapfile1

# enable swap
swapon /swapfile1

構建完成后,您可以禁用交換文件並將其刪除:

swapoff /swapfile1
rm /swapfile1

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM