[英]Rails gem installed but throws error
Looks like i have a problem trying to install rails gem. 看起来我在尝试安装Rails gem时遇到问题。
so i followed the steps from this tutorial , I am using Ubuntu 14.04, rbenv and ruby version 2.2.3 所以我按照本教程中的步骤操作,我正在使用Ubuntu 14.04,rbenv和ruby版本2.2.3
Basically my error is: 基本上我的错误是:
apparently I installed rails gem successfully 显然我成功安装了rails gem
$ gem install rails -v 4.2.4 $ gem安装导轨-v 4.2.4
-> Successfully installed rails-4.2.4
->
Successfully installed rails-4.2.4
but whenever i try to use rails command, for example: 但是每当我尝试使用rails命令时,例如:
$ rails -v $ rails -v
-> bin/rails:9:in require': cannot load such file -- rails/commands (LoadError) from bin/rails:9:in < main >'
->
bin/rails:9:in require': cannot load such file -- rails/commands (LoadError) from bin/rails:9:in < main >'
And got the same result for any other rails command 并获得与其他任何Rails命令相同的结果
I searched everywhere and noone seem to have the same problem as I do. 我到处搜索,似乎没有人遇到与我相同的问题。 I dont really know what to do now, any help will be really appreciated.
我真的不知道该怎么办,任何帮助将不胜感激。
Thanks in advance!! 提前致谢!!
UPDATE: apparently when I enter to a previously created rails app and try to run a rails command, this happens: 更新:显然,当我进入以前创建的rails应用程序并尝试运行rails命令时,会发生这种情况:
Could not find rake-10.5.0 in any of the sources
Run `bundle install` to install missing gems.
so after I run bundle install
everything works normally as it should... but if I leave the folder, then I am no longer able to use rails anymore, so I cannot create a new rails app or anything 因此,在我运行
bundle install
一切都会正常运行,但是……如果我离开文件夹,那么我将无法再使用Rails,因此无法创建新的Rails应用程序或其他任何东西
It sounds like you are sitting inside of a Rails repository already, since there is a bin/rails
. 听起来您已经坐在Rails信息库中,因为这里有
bin/rails
。 So try running bundle install
first---and if necessary gem install bundler
before that. 因此,请尝试首先运行
bundle install
-并在必要时先运行gem install bundler
。
I believe rails gem is not installed into your gemset try installing rails gem to gemset with : 我相信rails gem未安装到您的gemset中,尝试使用以下命令将rails gem安装到gemset:
sudo gem install rails
If problem still persists then may be your installations are not good & I recommend you to follow this Link to install ruby through rvm and then install rails gem to your gemset it will work. 如果问题仍然存在,则可能是您的安装效果不佳,我建议您按照此链接通过rvm安装ruby,然后将rails gem安装到您的gemset,它将起作用。
Open console
Select Edit -> Profile Preferences
Select tab: Title and Command
Check box 'Run command as a login shell'
Restart terminal
and try rvm use 2.2.1 --default
gem install rails --no-rdoc --no-ri
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.