我无法运行rails new SomeApp
。
我收到以下错误:
load': cannot load such file --
/home/captainawesome/.rvm/gems/ruby-2.2.0/gems/rails-4.2.0/bin/rails (LoadError)
浏览/home/captainawesome/.rvm/gems/ruby-2.2.0/gems/rails-4.2.0/bin/rails
中的路径, bin目录不存在 。
另外,请知道我仍然可以运行rails服务器和控制台,但不能运行rails new app
。
我当前的设置
Ubuntu 14.04
ruby 2.2.0p0
rails 4.2.0
rvm 1.26.11
local server (not remote)
development environment
$ which rails
/home/captainawesome/.rvm/gems/ruby-2.2.0/bin/rails
$ rails -v
Bundler is using a binstub that was created for a different gem.
This is deprecated, in future versions you may need to "bundle binstub rails"
to work around a system/bundle conflict.
Rails 4.2.0
请知道这只适用于项目内部。
$ which ruby
/home/captainawesome/.rvm/rubies/ruby-2.2.0/bin/ruby
$ ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
$which rvm
/home/captainawesome/.rvm/bin/rvm
$ rvm use
Using /home/captainawesome/.rvm/gems/ruby-2.2.0
$ rvm -v
rvm 1.26.11 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
请告知如何纠正此事。
答案 0 :(得分:4)
重新安装Rails,它将解决您的错误:
以下是:
gem install rails
尝试为您的Rails应用程序使用单独的gemsets,这将允许您在执行cd your_project_name
时快速自动更改Ruby版本和相关的gem。 Here's how。
答案 1 :(得分:2)
要添加Arslan Ali的正确答案,您还可以避免无尽的安装文档。如果你像我一样不耐烦,请执行:
gem install rails --no-ri --no-rdoc
然而,不耐烦也会带来匆忙和健忘。幸运的是,您可以使用此SO帖子中描述的默认使用方法跳过文档:How to make --no-ri --no-rdoc the default for gem install?
答案 2 :(得分:0)
更新为不赞成B. Bulpett的答案,没有文档的新安装方式是
gem install rails --no-document