Search code examples
ruby-on-railsrubyrspecrspec-rails

Spring will not start


I am receiving the following error when trying to start Spring (https://github.com/jonleighton/spring). I am running it in a Vagrant box with Ubuntu 12.04 LTS 12.04.

    vagrant@rails-starter-box:/vagrant/ticketee$ spring start
    /usr/local/rvm/gems/ruby-1.9.3-p194/gems/spring-0.0.8/lib/spring/server.rb:85:in `unlink': Text file busy - /vagrant/ticketee/tmp/spring/spring.pid (Errno::ETXTBSY)
            from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/spring-0.0.8/lib/spring/server.rb:85:in `unlink'
            from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/spring-0.0.8/lib/spring/server.rb:85:in `block (2 levels) in set_exit_hook'
            from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/spring-0.0.8/lib/spring/server.rb:84:in `each'
            from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/spring-0.0.8/lib/spring/server.rb:84:in `block in set_exit_hook'
    /usr/local/rvm/gems/ruby-1.9.3-p194/gems/spring-0.0.8/lib/spring/server.rb:34:in `initialize': Operation not permitted - /vagrant/ticketee/tmp/spring/spring (Errno::EPERM)
            from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/spring-0.0.8/lib/spring/server.rb:34:in `open'
            from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/spring-0.0.8/lib/spring/server.rb:34:in `boot'
            from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/spring-0.0.8/lib/spring/server.rb:15:in `boot'
            from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/spring-0.0.8/lib/spring/client/start.rb:13:in `call'
            from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/spring-0.0.8/lib/spring/client/command.rb:7:in `call'
            from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/spring-0.0.8/lib/spring/client.rb:23:in `run'
            from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/spring-0.0.8/bin/spring:4:in `'
            from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/spring:19:in `load'
            from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/spring:19:in `'
            from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
            from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `'

Solution

  • Because of Vagrant's read-only file system you need environment set the variable SPRING_TMP_PATH to somewhere outside of the /vagrant directory

    run this at the command line

    mkdir ~/spring_tmp; export SPRING_TMP_PATH=/home/vagrant/spring_tmp
    spring start
    

    then run

    spring status
    

    if spring is now running then add the following line to ~/.bashrc

    export SPRING_TMP_PATH="/home/vagrant/spring_tmp" # Temp PATH for spring
    

    Credit for this goes to George Brocklehurst