简体   繁体   中英

Rails Gem install fails after Rbenv

So when I run:

$ rails new mywebapp

I get the following error:

Your user account isn't allowed to install to the system Rubygems.

This is despite installing rbenv via Homebrew.

I have added the following to ~/.bash_profile

eval "$(rbenv init -)"

And installed a version of Ruby.

Running:

$ echo $PATH

Gives me:

/Users/myusername/.rbenv/shims:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

Im not sure where to go from here. Hoping someone can help.

Many thanks.

Agreeing with Dylan on the problem, I think that the best solution is to set explicitly an Rbenv global version using rbenv global 2.1.1 And then reinstalling bundler on that version.

gem uninstall bundler gem install bundler rbenv rehash

This worked good for me. Hope it helps.

Based on the comments to the original question, the answer was that the system-installed rails executable was being used instead of the rbenv version. The fix was to run:

gem install rails

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM