简体   繁体   English

Rbenv之后Rails Gem安装失败

[英]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. 尽管通过Homebrew安装了rbenv。

I have added the following to ~/.bash_profile 我已经将以下内容添加到〜/ .bash_profile中

eval "$(rbenv init -)"

And installed a version of Ruby. 并安装了一个版本的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. 在问题上与Dylan 达成共识 ,我认为最好的解决方案是使用rbenv global 2.1.1显式设置Rbenv全局版本 ,然后在该版本上重新安装bundler。

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. 根据对原始问题的评论,答案是使用系统安装的rails可执行文件而不是rbenv版本。 The fix was to run: 该修复程序可以运行:

gem install rails

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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