Search code examples
ruby-on-railsrubyvagrantvagrantfilevagrant-windows

Unable to start Rails in VM within Windows


I have installed rails on Vagrant and trying to create my first rails application, however "rails server" is taking a long time (i.e, never seem to complete after). I am using Windows and have installed Vargant and virtual box. On my Vagrant file, I have also updated core cpu and memory to the following

vb.customize ["modifyvm", :id, "--memory", "4096"]
vb.customize ["modifyvm", :id, "--cpus", "2"]

but still can't seem to start rails on my VM Rails version is 4.2.6

below is the screen capture

Note: The command prompt is never returned after this point


Solution

  • rails server like any web server is meant to run as a persistent process. It sits there and waits for web requests - so the behavior you are seeing is actually exactly how it is supposed to work.

    To exit the server (and most unix programs) you can send the terminate command with CTRL + C.

    You can also run the server in the background in Bash by starting it with:

    rails s &
    

    You can then return it to the foreground with fg. Although I usually just open another shell window instead.