开发者

rubygem "Argument list too long"

My problem is that during or after running a process which uses Ruby intensively, when I use any gem command including gem --version or gem install rake, it hangs for just over a minute and then gives me this error:

$ gem list
/Users/username/.rvm/bin/gem: line 5: /Users/username/.rvm/bin/gem: Argument list too long
/Users/username/.rvm/bin/gem: line 5: /Users/username/.rvm/bin/gem: Unknown error: 0

file at : line 5: /Users/username/.rvm/bin/gem

#!/usr/bin/env bash

if [[ -s "/Users/username/.rvm/environments/ruby-开发者_如何学运维1.8.7-p334" ]] ; then
  source "/Users/username/.rvm/environments/ruby-1.8.7-p334"
  exec gem "$@"                # this is line 5
else
  echo "ERROR: Missing RVM environment file: '/Users/username/.rvm/environments/ruby-    1.8.7-p334'" >&2
exit 1
fi

The only way that I have found to get this working again is to restart my computer, which is obviously undesirable. I am using OSX 10.6.5

I have spent quite a while trying to find anyone else who has had this problem, and been unsuccessful. Do you have any idea why this might be happening?


This issue is that you set rvm to use --default a nonexistent ruby version.

You have to specify it exactly, or it doesn't work correctly.


Solved it by calling

rvm use 1.9.3

istead of

rvm use 1.9.3 --default

Everything works now.


Seems like you're calling your script recursively...

You can

  1. Rename your script

  2. Use the full /usr/bin/gem path to refer to rubygems

Edit: Bonus points and a magic cookie to whoever can tell me why her script is being called recursively. Just FYI it should not be happening under normal circumstances ;)


I found this was because the permissions on /usr/local/rvm/rubies/$RUBY_VERSION/bin/gem where wrong. I corrected them by running:

sudo chown -R root:rvm /usr/local/rvm

You will also need to add your user to the rvm group:

sudo gpasswd -a YOUR_USERNAME rvm


I solved this issue by installing RailsInstaller


i was able to fix this problem (when installing a gem) by using

     rvm all do gem install <gemname>

in your case it would be :

    rvm all do gem list


I get this error as well. For me it's solved by leaving the project folder and then go back into the project folder afterwards. I'm not sure why this works, but maybe it'll work for others too.

cd ..

cd project

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜