railsgoat
railsgoat copied to clipboard
Bug: Error running rails db:setup on a fresh install
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:inrequire_relative' /Users/joelbrewer/Repos/railsgoat/Rakefile:5:in
<top (required)>' script/rails:7:inrequire' 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).
What version of ruby are you using?
Using rbenv -- this was the only 2.7.0 version available.
I use rvm with .rvmrc: rvm use [email protected] --create
Got it - I'll try using rvm
👍
Any update on. This has been a nightmare to install on a fresh ubuntu instance as well as a docker container.
@treprime are you using RVM as noted above?
@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
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.