rails: Changing development server port does not take effect

Sorry if this is a bad issue - I’m just starting out with rails and encountered this. I did a search on GitHub and didn’t find anything relating to this issue I’m seeing. Please let me know if I messed something up or you need more information.

Steps to reproduce

This is on a fresh install - right from the guide. I ran the following commands:

rails new blog
cd blog
./bin/rails server -p 3002

And this is the output:

/home/brian/.rvm/gems/ruby-2.4.0-rc1/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:51: warning: constant ::Fixnum is deprecated
/home/brian/.rvm/gems/ruby-2.4.0-rc1/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:52: warning: constant ::Bignum is deprecated
=> Booting Puma
=> Rails 5.0.1 application starting in development on http://localhost:3002
=> Run `rails server -h` for more startup options
/home/brian/.rvm/gems/ruby-2.4.0-rc1/gems/activesupport-5.0.1/lib/active_support/core_ext/numeric/conversions.rb:138: warning: constant ::Fixnum is deprecated
Puma starting in single mode...
* Version 3.7.0 (ruby 2.4.0-p-1), codename: Snowy Sagebrush
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Exiting

Expected behavior

The server should attempt to start on port 3002.

Actual behavior

The server attempts to start on port 3000. As you can see in the logs above, the rails server acknowledges the command line parameter (in the log line “Rails 5.0.1 application starting in development on http://localhost:3002”), but below it attempts to listen on port 3000 (“Listening on tcp://0.0.0.0:3000”)

System configuration

Rails version: Rails 5.0.1

Ruby version: ruby 2.4.0rc1 (2016-12-12 trunk 57064) [x86_64-linux]

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 20 (3 by maintainers)

Most upvoted comments

and if you start it liek:

PORT=3002 rails s

does teh port change to 3002 or stay 3000?