抱歉,这可能是一个基本问题,但我是 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/