Rails generate error: No such file or directory - getcwd

后端 未结 4 1533
小蘑菇
小蘑菇 2021-01-04 08:09

When running rails generate on a new Rails 4.2 project, I keep getting the error:

~/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.3.0         


        
相关标签:
4条回答
  • 2021-01-04 08:33

    On my machine the same problem was arising because spring server stopped responding.

    1:- To restart the spring server type in terminal

    $: spring restart
    

    2:- Try running the generator again.

    0 讨论(0)
  • 2021-01-04 08:47

    This error may also occur if you are working in a directory which was deleted from some other terminal instance.

    0 讨论(0)
  • 2021-01-04 08:49

    The error is caused by an existing Rails Spring process running in the background.

    You can easily solve this by running ps ax | grep spring to find the process id and then kill it.

    There's an issue on the Rails GitHub about this: https://github.com/rails/spring/issues/247

    0 讨论(0)
  • 2021-01-04 08:51

    If the directory (or some sub directory Rails will work with) you are working was renamed or removed, you'll have to run

    cd .
    

    and then you can run rails generate [...].

    0 讨论(0)
提交回复
热议问题