2
2

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 3 years have passed since last update.

Ruby rails コマンドや repecコマンドが使えなくなった時の話

Posted at

概要

こんにちは

先日、Laravelの環境構築でhomebrewなどいろいろいじっていたら
Railsのプロジェクトで

rails s
rails c
rspec

みたいなコマンドが一通り使えなくなった。

rails sできない

rails s すると

You've tried to invoke Spring when it's already loaded (i.e. the Spring constant is defined).

This is probably because you generated binstubs with Spring 1.0, and you now have a Spring version > 1.0 on your system. To solve this, upgrade your bundle to the latest Spring version and then run `bundle exec spring binstub --all` to regenerate your binstubs. This is a one-time step necessary to upgrade from 1.0 to 1.1.

Here's the backtrace:

/Users/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:287:in `load'
/Users/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:287:in `block in load'
/Users/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:259:in `load_dependency'
/Users/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:287:in `load'
/Users/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
/Users/username/.rbenv/versions/2.5.1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Users/username/.rbenv/versions/2.5.1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Users/username/projects/bookcafe-review-app/bin/spring:16:in `<top (required)>'
bin/rails:5:in `load'
bin/rails:5:in `<main>'

いろいろ調べた結果
この記事

brew switch openssl 1.0.2s

このコマンドをすると

rails s
rails c
できるようになった。

一安心と思いきや
次は

rspec できない

rspecコマンドを実行すると
db exist みたいなエラーが出たので、
test用のdbをリセットしてみたり試みたが
permission errorになる(errno: 13)

次は
この記事より

sudo chown -R _mysql /usr/local/var/mysql

で権限を与える

phpをインストールすると権限が変わったみたいです。

ようやく正常に動きました。

2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?