4
5

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.

Bundle exec rails generate rspec:install を実行しても動かなかった時の対処法

Last updated at Posted at 2018-08-16

Rails5にrspecを導入しようと、bundle installした後に、下記コマンドを打ち込んだところターミナルが止まってしまった。

$ bundle exec rails generate rspec:install

ctrl + c で強制終了したところspring関連のところで止まっていたっぽい

    16: from bin/rails:3:in `<main>'
	15: from bin/rails:3:in `load'
	14: from /Users/ユーザ名/ワークディレクトリ名/アプリケーション名/rails/bin/spring:15:in `<top (required)>'
	13: from /Users/ユーザ名//.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:70:in `require'
	12: from /Users/ユーザ名//.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:70:in `require'
	11: from /Users/ユーザ名//.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
	10: from /Users/ユーザ名//.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
	 9: from /Users/ユーザ名//.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
	 8: from /Users/ユーザ名//.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
	 7: from /Users/ユーザ名//.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
	 6: from /Users/ユーザ名//.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/rails.rb:24:in `call'
	 5: from /Users/ユーザ名//.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
	 4: from /Users/ユーザ名//.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/run.rb:35:in `call'
	 3: from /Users/ユーザ名//.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/run.rb:42:in `warm_run'
	 2: from /Users/ユーザ名//.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/run.rb:62:in `run'
	 1: from /Users/ユーザ名//.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/run.rb:117:in `verify_server_version'

とりあえずspringを停止してみたところうまくいった。
springの停止コマンド

$ bin/spring stop 
Spring stopped.

再度rspecのコマンドを実行

$ bundle exec rails generate rspec:install
Running via Spring preloader in process 60241
      create  .rspec
      create  spec
      create  spec/spec_helper.rb
      create  spec/rails_helper.rb

無事ファイルが作られた。
springのstatusを確認したら自動的にspringも起動されていた。

$ bin/spring status                                                                                                               606ms  木  8/16 12:15:07 2018
Spring is running:

60196 spring server | rails | started 13 mins ago   
60230 spring app    | rails | started 13 mins ago | development mode  
4
5
0

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
4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?