Fail to upgrade - Make sure that `gem install json -v '1.8.2'` succeeds before bundling

The current swap size is 1GB. Does it help if I increase swap size to 2 GB?

swapon -s
Filename                                Type            Size    Used    Priority
/swapfile                               file            1048572 77896   -1