I followed the instructions here https://www.fullstackreact.com/articles/how-to-get-create-react-app-to-work-with-your-rails-api/ to create a react app with a rails backend. Basically, I have the rails api proxied through localhost:3001, as specified here in package.json:
{
"name": "fidirect",
"version": "0.1.0",
"private": true,
"proxy": "http://localhost:3001/",
"devDependencies": {
"enzyme": "2.4.1",
"react-addons-test-utils": "15.4.0",
"react-scripts": "0.8.5"
},
I have foreman in the gemfile, and a procfile that looks like this:
web: cd client && npm start
api: bundle exec rails s -p 3001
I have a rake task to handle booting both servers, in lib/tasks/start.rake, that looks like this:
task :start do
exec 'foreman start -p 3000'
end
All of this is exactly as specified in the README for the sample app, but when I hit rake start, I see this error:
started with pid 24179
05:24:10 api.1 | started with pid 24180
05:24:13 web.1 |
05:24:13 web.1 | > fidirect@0.1.0 start /home/adt6261-
133051/code/FiDirect/client
05:24:13 web.1 | > react-scripts start
05:24:13 web.1 |
05:24:22 web.1 | Attempting to bind to HOST environment variable:
138.68.11.226
05:24:22 web.1 | If this was unintentional, check that you haven't
mistakenly set it in your shell.
05:24:22 web.1 | Learn more here:
05:24:22 web.1 |
05:24:22 web.1 | Something is already running on port 3000.
05:24:23 api.1 | => Booting Puma
05:24:23 api.1 | => Rails 5.1.4 application starting in development
05:24:23 api.1 | => Run `rails server -h` for more startup options
05:24:23 api.1 | Puma starting in single mode...
05:24:23 api.1 | * Version 3.11.2 (ruby 2.3.1-p112), codename: Love Song
05:24:23 api.1 | * Min threads: 5, max threads: 5
05:24:23 api.1 | * Environment: development
05:24:23 api.1 | * Listening on tcp://138.68.11.226:3001
05:24:23 api.1 | Use Ctrl-C to stop
05:24:23 web.1 | exited with code 0
05:24:23 system | sending SIGTERM to all processes
05:24:23 api.1 | - Gracefully stopping, waiting for requests to finish
05:24:23 api.1 | === puma shutdown: 2018-02-07 05:24:23 +0000 ===
05:24:23 api.1 | - Goodbye!
05:24:23 api.1 | Exiting
05:24:23 api.1 | terminated by SIGTERM
Has anyone encountered a similar issue before/ know what the problem might be? Any input greatly appreciated.