终端“rails 生成控制器页面主页”不工作

Terminal “rails generate controller pages home” not working

因此,我输入以下命令来生成一个页面:

rails 生成控制器主页

跟随这个终端停止响应,这花了我很多时间。我不得不使用 C^ 退出。当我这样做时,会显示以下文本:

      /Library/Ruby/Gems/2.0.0/gems/spring-1.3.3/lib/spring/client/run.rb:78:in `sleep': Interrupt
from /Library/Ruby/Gems/2.0.0/gems/spring-1.3.3/lib/spring/client/run.rb:78:in `boot_server'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.3.3/lib/spring/client/run.rb:51:in `cold_run'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.3.3/lib/spring/client/run.rb:28:in `call'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.3.3/lib/spring/client/command.rb:7:in `call'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.3.3/lib/spring/client/rails.rb:23:in `call'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.3.3/lib/spring/client/command.rb:7:in `call'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.3.3/lib/spring/client.rb:26:in `run'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.3.3/bin/spring:48:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.3.3/lib/spring/binstub.rb:11:in `load'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.3.3/lib/spring/binstub.rb:11:in `<top (required)>'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/prafulk/code/omrails/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>

我不知道发生了什么。这是我在我的应用程序中 运行:

ruby 2.2.0p0 rails4.2.0

如有任何帮助,我们将不胜感激!

您说您尝试使用 ruby 2.2.0,但看起来您使用的是系统 Ruby 版本 (2.0.0)。 我会确保您使用的是 ruby 版本管理器(rbenv 或 rvm),以便您可以设置本地(项目)ruby 版本并为每个版本安装所需的 gem。

您正在查看堆栈跟踪。当您查看此内容时,您会自下而上地查看。

这是正在发生的事情(忽略 bin/rails)。 from /Users/prafulk/code/omrails/bin/spring:13:in '<top (required)>' 行表示文件 /Users/prafulk/code/omrails/bin/spring 中的 13 行遇到错误,这使得堆栈中的其余内容发生,以 sleep interupted 结尾,因为你按下 ^c

查看 spring 中的第 13 行。

从您的 Gemfile 中删除 Spring,因为它似乎给您带来了困难。