0

I'm trying a classic Ruby install via RVM un Cloud9, but I get a bash error:

bash: 1.1G: syntax error: invalid arithmetic operator (error token is ".1G")

Screenshot of the error

UPDATE:

So I did some digging into the RVM script which does the magic, and it seems this error comes from this part of the script /usr/local/rvm/scripts/functions/utility (line 416):

__rvm_calculate_space_free()
{
  # OpenBSD does not have 'df -m' param
  __free_space="$( \command \df -Pk "$1" | __rvm_awk 'BEGIN{x=4} /Free/{x=3} $3=="Avail"    {x=3} END{print $x}' )"
  if [[ "${__free_space}" == *M ]]
  then __free_space="${__free_space%M}" # some systems ignore -k and print M
  else __free_space="$(( __free_space / 1024 ))"
  fi
}

This is way beyond my knowledge, but it would seem to me that the reported free space includes that G which somehow messes with the operation, hence the arithmetic error.

Any help appreciated.

  • Cloud9 uses is onw version of df that is not compatibible with RVM options `-Pk`. The team is working on a fix. In the meantime there is a fix in RVM to solve the issue: https://github.com/wayneeseguin/rvm/issues/2958#event-159335592 – lcipriani Sep 08 '14 at 12:48

2 Answers2

0

Could you try installing it as root (so with 'sudo rvm install 1.9.2')?

Ivar Pruijn
  • 393
  • 1
  • 5
  • rvm generally doesn't need to be installed as root. In fact, to be able to work with sudo at all, you need to do some tricks (i.e. to use `rvmsudo`. Still, you should never have to install stuff with rvm using sudo. – Holger Just Sep 08 '14 at 10:57
  • I also tried sudo, but it's the same issue. Like @HolgerJust said, you shouldn't need to do it anyway. I did some more digging and will update the issue. – Rafael Rebolleda Sep 08 '14 at 11:35
0

A solution is to modify your PATH variable like from:

$ echo $PATH
/home/ubuntu/.nvm/v0.10.30/bin:/usr/local/rvm/gems/ruby-2.1.1@rails4/bin:/usr/local/rvm/gems/ruby-2.1.1@global/bin:/usr/local/rvm/rubies/ruby-2.1.1/bin:/mnt/shared/bin:/home/ubuntu/workspace/node_modules/.bin:/home/ubuntu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/mnt/shared/sbin:/opt/gitl:/opt/go/bin:/mnt/shared/c9/app.nw/bin:/usr/local/rvm/bin

to

$ export PATH=/home/ubuntu/.nvm/v0.10.30/bin:/usr/local/rvm/gems/ruby-2.1.1@rails4/bin:/usr/local/rvm/gems/ruby-2.1.1@global/bin:/usr/local/rvm/rubies/ruby-2.1.1/bin:/home/ubuntu/workspace/node_modules/.bin:/home/ubuntu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/mnt/shared/sbin:/opt/gitl:/opt/go/bin:/mnt/shared/c9/app.nw/bin:/usr/local/rvm/bin:/mnt/shared/bin

Note the /mnt/shared/bin dir is now at the last position of the PATH variable.

lcipriani
  • 363
  • 2
  • 7