繁体   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