63
61

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

railsのコマンドが動かない時はspringを(stop|kill)してみよう

Posted at

突然railsのmigrationコマンドが動かなくなって泣きそうになりました。
にっちもさっちもいかないので、強制停止するとspring関連のエラログが出ています。


$ rails g migration create_publisher_contacts
/Users/yokozawa/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/spring-1.1.2/lib/spring/client/run.rb:47:in `gets': Interrupt
	from /Users/yokozawa/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/spring-1.1.2/lib/spring/client/run.rb:47:in `verify_server_version'
	from /Users/yokozawa/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/spring-1.1.2/lib/spring/client/run.rb:19:in `call'
	from /Users/yokozawa/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/spring-1.1.2/lib/spring/client/command.rb:7:in `call'
	from /Users/yokozawa/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/spring-1.1.2/lib/spring/client/rails.rb:23:in `call'
	from /Users/yokozawa/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/spring-1.1.2/lib/spring/client/command.rb:7:in `call'
	from /Users/yokozawa/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/spring-1.1.2/lib/spring/client.rb:26:in `run'
	from /Users/yokozawa/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/spring-1.1.2/bin/spring:48:in `<top (required)>'
	from /Users/yokozawa/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/spring-1.1.2/lib/spring/binstub.rb:11:in `load'
	from /Users/yokozawa/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/spring-1.1.2/lib/spring/binstub.rb:11:in `<top (required)>'
	from /Users/yokozawa/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /Users/yokozawa/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /Users/yokozawa/dev/connect/bin/spring:16:in `<top (required)>'
	from bin/rails:3:in `load'
	from bin/rails:3:in `<main>'

とりあえずspringを止めてみましょう。


$ spring stop
Spring is not running

ファッ!!?!

「なんだこれは・・・?」と考えること5分、そうだプロセス見てみよう。


$ ps aux | grep spring
yokozawa        1838   0.0  0.0  2484624   3440 s006  S     2:46PM   0:00.75 spring server | my_app | started 54 mins ago
yokozawa        2682   0.0  0.0  2432772    484 s006  R+    3:41PM   0:00.00 grep spring

なんか居たのでkillする。


$ kill -9 1838
$ ps aux | grep spring
yokozawa        2684   0.0  0.0  2432772    640 s006  S+    3:41PM   0:00.00 grep spring

動いたぜー!


$ rails g migration create_publisher_contacts
      invoke  active_record
      create    db/migrate/20150629064143_create_publisher_contacts.rb

63
61
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
63
61

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?