railsgoat icon indicating copy to clipboard operation
railsgoat copied to clipboard

Bug: Error running rails db:setup on a fresh install

Open joelbrewer opened this issue 5 years ago • 8 comments

Running rails db:setup returns an error.

🐞 Problem

I performed a fresh clone, bundle install, and subsequent rails db:setup and received the following error:

rails aborted! FrozenError: can't modify frozen String: "railties_load_path=" /Users/joelbrewer/Repos/railsgoat/config/application.rb:4:in require' /Users/joelbrewer/Repos/railsgoat/config/application.rb:4:in <top (required)>' /Users/joelbrewer/Repos/railsgoat/Rakefile:5:in require_relative' /Users/joelbrewer/Repos/railsgoat/Rakefile:5:in <top (required)>' script/rails:7:in require' script/rails:7:in

'

Steps to reproduce:

  • git clone
  • bundle install
  • rails db:setup

💡 Possible solutions

I have a feeling this could be a ruby/rails version issue (I noticed the Ruby version was recently upgraded).

joelbrewer avatar Oct 15 '19 19:10 joelbrewer

What version of ruby are you using?

jasnow avatar Oct 15 '19 19:10 jasnow

image

Using rbenv -- this was the only 2.7.0 version available.

joelbrewer avatar Oct 15 '19 19:10 joelbrewer

I use rvm with .rvmrc: rvm use [email protected] --create

jasnow avatar Oct 15 '19 19:10 jasnow

Got it - I'll try using rvm 👍

joelbrewer avatar Oct 15 '19 20:10 joelbrewer

Any update on. This has been a nightmare to install on a fresh ubuntu instance as well as a docker container.

treisland avatar Oct 19 '19 22:10 treisland

@treprime are you using RVM as noted above?

cktricky avatar Oct 20 '19 00:10 cktricky

@cktricky I managed to get it working on my instance of Ubuntu. Steps below

  • Install ruby and ruby-build

     sudo apt-get install ruby \
     ruby-build -y
    
  • Install mysql

      sudo apt-get install mysql-server \
      mysql-client \
      libmysqlclient-dev
    
  • Install rvm (ruby version manager)

      curl -sSL https://get.rvm.io | bash
    
  • source the directory

      source ~/.rvm/scripts/rvm
    
  • Install the bundler

      gem install bundler
    
  • Clone railsgoat

      git clone https://github.com/OWASP/railsgoat.git
      cd railsgoat
    
  • Install ruby 2.7 preview

      rvm install "ruby-2.7.0-preview1"
    
  • Install the bundles

      bundle install
    
  • Setup the database

      bundle exec rake db:setup
    
  • Start the server

      bundle exec rails server
    
  • Open a browser and navigate to http://localhost:3000

treisland avatar Oct 20 '19 01:10 treisland

Thank you @tre-island. I think I need to try and build this on a fresh ubuntu install to see what we could improve on our end.

cktricky avatar Jun 23 '20 18:06 cktricky