Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: `getwd` : No such file or directory - getcwd? [duplicate]

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/lib/spring/configuration.rb:37:in `pwd': No such file or directory - getcwd (Errno::ENOENT)

How can I fix this?

like image 525
Nick Urban Avatar asked Feb 08 '15 03:02

Nick Urban


3 Answers

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

like image 195
Nick Urban Avatar answered Nov 30 '22 08:11

Nick Urban


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

like image 34
Abhiram Avatar answered Nov 30 '22 09:11

Abhiram


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 [...].

like image 23
Vinicius Brasil Avatar answered Nov 30 '22 08:11

Vinicius Brasil