ruby-on-rails - 运行 rails new 时出现 Rubygems 问题

标签 ruby-on-rails gem rubygems

抱歉,这可能是一个基本问题,但我是 Rails 新手。
我想通过命令 rails new projName 开始一个新的 rails 项目.在这个过程中,我收到了这条消息:

run  bundle install

Your user account isn't allowed to install to the system Rubygems.
You can cancel this installation and run:

bundle install --path vendor/bundle

to install the gems into ./vendor/bundle/, or you can enter your password
and install the bundled gems to Rubygems using sudo.

Password:

我不太确定是否应该提供我的密码,但我搜索了 I found that it is safe to do that (或者至少是我所理解的)。

最后我收到了这个警告:
Warning: You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
* bin/rake: spring inserted
* bin/rails: spring inserted

所以我试着运行 gem install Rubygems我得到了:
ERROR:  Could not find a valid gem 'Rubygems' (>= 0) in any repository
ERROR:  Possible alternatives: ruby_gem, ruby_gem_eg, ruby-rets, ruby-gen, rubyless

我试过 gem install rubygems-update我得到了:
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

我已经通过 RVM 安装了 rails,但我不确定为什么会出现这些权限问题。由于我对 gem 没有经验,所以我被困住了,不知道如何解决这些问题。

最佳答案

运行以下程序就足够了:

gem update --system

将 Rubygem 升级到最新版本。

关于ruby-on-rails - 运行 rails new 时出现 Rubygems 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29007765/

相关文章:

permissions - 执行 gem 时出错...权限被拒绝

java - JRuby/Nokogiri 在 Mule ESB 3 中找不到 Java XML 库

ruby-on-rails - 带有 url、format 和 html 选项的 Form_for

ruby-on-rails - 将 Google Maps (API V3) 支持添加到 Ruby on Rails 应用程序

ruby-on-rails - Ruby on Rails 中的 Multi-Tenancy 架构

ruby - bundle 成功但未加载所有 gem

ruby - 如何构建自己的 gem 并在另一个项目中使用它?

ruby-on-rails - 成功的 heroku 运行 rake db :migrate but columns don't seem to work

ruby-on-rails - Sphinx 中的重音不敏感排序

ruby-on-rails - Rails 3.1 引擎 : Difference of my_engine. gemspec、add_dependency、add_development_dependency 和 Gemfile