27歳未経験でエンジニア転職した元営業マン

アルバイトで半年間をドブに捨てた後、2ヶ月でエンジニア転職した記録

No such file or directory - getcwd (Errno::ENOENT)

エラー内容

h2tomo:everydayrails-rspec-2017 tomohiro$ bin/rails g rspec:model user
/Users/tomohiro/work/everydayrails-rspec-2017/vendor/cache/gems/spring-2.0.1/lib/spring/configuration.rb:37:in `pwd': No such file or directory - getcwd (Errno::ENOENT)
    from /Users/tomohiro/work/everydayrails-rspec-2017/vendor/cache/gems/spring-2.0.1/lib/spring/configuration.rb:37:in `project_root_path'
    from /Users/tomohiro/work/everydayrails-rspec-2017/vendor/cache/gems/spring-2.0.1/lib/spring/configuration.rb:28:in `application_root_path'
    from /Users/tomohiro/work/everydayrails-rspec-2017/vendor/cache/gems/spring-2.0.1/lib/spring/application.rb:258:in `loaded_application_features'
    from /Users/tomohiro/work/everydayrails-rspec-2017/vendor/cache/gems/spring-2.0.1/lib/spring/application.rb:105:in `ensure in preload'
    from /Users/tomohiro/work/everydayrails-rspec-2017/vendor/cache/gems/spring-2.0.1/lib/spring/application.rb:112:in `preload'
    from /Users/tomohiro/work/everydayrails-rspec-2017/vendor/cache/gems/spring-2.0.1/lib/spring/application.rb:143:in `serve'
    from /Users/tomohiro/work/everydayrails-rspec-2017/vendor/cache/gems/spring-2.0.1/lib/spring/application.rb:131:in `block in run'
    from /Users/tomohiro/work/everydayrails-rspec-2017/vendor/cache/gems/spring-2.0.1/lib/spring/application.rb:125:in `loop'
    from /Users/tomohiro/work/everydayrails-rspec-2017/vendor/cache/gems/spring-2.0.1/lib/spring/application.rb:125:in `run'
    from /Users/tomohiro/work/everydayrails-rspec-2017/vendor/cache/gems/spring-2.0.1/lib/spring/application/boot.rb:19:in `<top (required)>'
    from /Users/tomohiro/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    from /Users/tomohiro/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    from -e:1:in `<main>'

解決策

ps ax | grep spring でbackgroundで起動中のものを確認し、すべてのプロセスをkillで削除

h2tomo:everydayrails-rspec-2017 tomohiro$ ps ax | grep spring
 3366   ??  Ss     0:05.17 spring app    | my_app | started 20 hours ago | development mode
48060   ??  Ss     0:00.11 ruby -I /Users/tomohiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib -I /Users/tomohiro/work/everydayrails-rspec-2017/vendor/cache/gems/spring-2.0.1/lib -e require 'spring/application/boot'
 1436 s001  S      0:00.52 spring server | my_app | started 43 hours ago
27731 s001  S      0:00.34 spring server | everydayrails-rspec-2017 | started 1 hour ago
48111 s001  S+     0:00.00 grep spring
h2tomo:everydayrails-rspec-2017 tomohiro$ kill -9 3366
h2tomo:everydayrails-rspec-2017 tomohiro$ kill -9 48060
h2tomo:everydayrails-rspec-2017 tomohiro$ kill -9 1436
h2tomo:everydayrails-rspec-2017 tomohiro$ kill -9 27731
h2tomo:everydayrails-rspec-2017 tomohiro$ ps ax | grep spring
48133 s001  S+     0:00.00 grep spring
h2tomo:everydayrails-rspec-2017 tomohiro$ bin/rails g rspec:model user
Running via Spring preloader in process 48164
      create  spec/models/user_spec.rb

参考サイト

Rails generate error: No such file or directory - getcwd