开发者

Rails and Rake commands hang and do nothing at all

I don't know why but when I run rake commands in my rails project, nothing happens. Also rails server does nothing. Any s开发者_如何转开发uggestions?


you can add an "ruby -rtracer" to the begining to see where it is hanging.


The solution for me entailed exiting rails console -sandbox.

I think sandboxing console puts a lock of some sort on the database.


You could try adding the --trace argument to your rake calls to see if that sheds any light on where it is getting stuck. Failing that there may be some information in the logs.

It does suggest that something that is getting stuck during setting up your environment which may be something you've added to environment.rb.


Are you using rvm?

A lot of advice these days is to install ruby within rvm and rails within an rvm gemset. If you've done this, then you need to remember to do commands such as these at the start of your terminal session:

rvm use 1.9.3
rvm gemset use ruby193rails3

I found if I forgot to do this, then the rake command, even just a simple rake --version , would hang and thrash the disk.

...which all seems a bit fragile. I guess it's latching onto part of rails but with some files missing due to rvm not having moved them into place or something.


Spring has a bug in Rails 4.1 which also causes this (not the OP's issue, based on date). For those googling, I solved this problem my typing "spring stop". Spring will be automatically restarted the next time you run "rails ". To give proper credit, I found this information from this blog: http://www.dixis.com/?p=754


What fixed this for me was running

bin/spring stop

and then running my rake command after.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜