I have two different projects - one that I made for practicing purpose and one that is a real project.
I'm using RVM to set version and they both run on 2.6.0 & rails 5.2.3
My practice project launches fine on localhost:3000. However I can't see anywhere or anyhow that it's being used while running the app (checking in resource manager/netstat)
However when I'm trying to launch the second app I'm getting "listen: Address already in use - listen(2) and rails shuts down.
I've tried restarting the terminal/my computer just to make sure nothing is running on port 3000 and I can't for the life of me understand why it's not working.
Has anyone experienced something similar? I've obviously tried looking at similar questions here however most answers are related to terminating whatever is running on 3000 at the moment, but I can't confirm that anything is.
UPDATED:
Ok so when I launch the app that complains about port being in use I get the following:
/usr/share/rvm/rubies/ruby-2.6.0/bin/ruby: warning: shebang line ending with \r may cause problems
After that it tries to start, it says it's listening on tcp://127.0.0.1:3000 which is fine and dandy, but then it stops and here's the trace:
Traceback (most recent call last):
19: from bin/rails:4:in `<main>'
18: from bin/rails:4:in `require'
17: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<top (required)>'
16: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/railties-5.2.3/lib/rails/command.rb:46:in `invoke'
15: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/railties-5.2.3/lib/rails/command/base.rb:65:in `perform'
14: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
13: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
12: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
11: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:142:in `perform'
10: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:142:in `tap'
9: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:147:in `block in perform'
8: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:53:in `start'
7: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:297:in `start'
6: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/puma-4.3.0/lib/rack/handler/puma.rb:73:in `run'
5: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/puma-4.3.0/lib/puma/launcher.rb:172:in `run'
4: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/puma-4.3.0/lib/puma/cluster.rb:463:in `run'
3: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/puma-4.3.0/lib/puma/runner.rb:82:in `start_control'
2: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/forwardable.rb:230:in `add_unix_listener'
1: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/puma-4.3.0/lib/puma/binder.rb:328:in `add_unix_listener'
/home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/puma-4.3.0/lib/puma/binder.rb:328:in `listen': Address already in use - listen(2) (Errno::EADDRINUSE)
Breadcrumb Mongo query succeeded meta_data collection:Array has been dropped for having an invalid data type
Is it possible that it has to do with file origins? My project runs fine because it's written in windows but I can't run the other one that was written on MAC, with the different line endings and all. I've heard Ruby can be sensitive when you run it on windows machines.
So apparantly this was caused by
activate_control_app
in my puma.rb file. When I commented it out the app launched fine.
Related
I have installed CocoaPods on my system via terminal with the command:
gem install cocoapods
Apparently everything went well.
Now I have a new Xcode project that I want to initialize CocoaPods. I am in the working directory for the new app and I type:
pod init
and receive this back:
Traceback (most recent call last):
10: from /usr/local/bin/pod:23:in `<main>'
9: from /usr/local/bin/pod:23:in `load'
8: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
7: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:49:in `run'
6: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:140:in `verify_minimum_git_version!'
5: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:126:in `git_version'
4: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/executable.rb:148:in `capture_command'
3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:390:in `capture2e'
2: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:208:in `popen2e'
1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:213:in `popen_run'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:213:in `spawn': Bad CPU type in executable - /usr/local/bin/git (Errno::EBADARCH)
Randy#RANDYS-MAC-PRO-3 CTHelpDemo %
In the end there is no Podfile in the directory. Any help would be greatly appreciated.
I am running Big Sur V11.4. The terminal is using zsh.
We just upgraded a Rails app to 4.2 to 5.2, everything is working like a charm in development, but when we try to release the app on our production servers, we can't run any rails related commands (assets precompilation, migrate, console, etc.).
Here is the trace:
Traceback (most recent call last):
15: from bin/rails:4:in `<main>'
14: from bin/rails:4:in `require'
13: from /var/deploy/slaask_kb/web_head/shared/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<top (required)>'
12: from /var/deploy/slaask_kb/web_head/shared/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command.rb:46:in `invoke'
11: from /var/deploy/slaask_kb/web_head/shared/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command/base.rb:65:in `perform'
10: from /var/deploy/slaask_kb/web_head/shared/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
9: from /var/deploy/slaask_kb/web_head/shared/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
8: from /var/deploy/slaask_kb/web_head/shared/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
7: from /var/deploy/slaask_kb/web_head/shared/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/commands/console/console_command.rb:95:in `perform'
6: from /var/deploy/slaask_kb/web_head/shared/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
5: from /var/deploy/slaask_kb/web_head/shared/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command/actions.rb:28:in `require_environment!'
4: from /var/deploy/slaask_kb/web_head/shared/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/application.rb:337:in `require_environment!'
3: from /var/deploy/slaask_kb/web_head/shared/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:292:in `require'
2: from /var/deploy/slaask_kb/web_head/shared/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
1: from /var/deploy/slaask_kb/web_head/shared/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
/var/deploy/slaask_kb/web_head/shared/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require': failed to allocate memory (NoMemoryError)
We added puts file; just before the result = super in dependencies.rb:291, and a puts 'ERROR!' in the rescue in dependencies.rb#L260 and here are the last loaded files:
active_support/per_thread_registry
rack/runtime
rack/utils
active_support/cache/strategy/local_cache_middleware
rack/body_proxy
rack/utils
tzinfo/data
ERROR!
active_support/core_ext/time/zones
ERROR!
Traceback (most recent call last):
More information:
There is 52G of memory on the server, and we already tried adding 10G of SWAP.
Running htop is not giving any Memory leak
EDIT:
We tried removing the raise in dependencies.rb#L261 and of course the console loads, here are the logs:
rack/body_proxy
rack/utils
tzinfo/data
ERROR!
active_support/core_ext/time/zones
tzinfo/data/definitions/America/New_York
ERROR!
/var/deploy/slaask_kb/web_head/shared/bundle/ruby/2.6.0/gems/tzinfo-1.2.5/lib/tzinfo/ruby_data_source.rb:35: warning: constant ::Data is deprecated
/var/deploy/slaask_kb/web_head/shared/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:396: warning: constant ::Data is deprecated
/var/deploy/slaask_kb/web_head/shared/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/inflector/methods.rb:283: warning: constant ::Data is deprecated
ERROR!
rails/console/app
active_support/all
action_controller
rails/console/helpers
active_record/base
pp
Loading production environment (Rails 5.2.3)
e2mmap
ERROR!
irb(main):001:0>
I was able to reproduce the issue on a development environment (Windows Subsystem for Linux) too.
We finally managed to solve it by upgrading tzinfo from 1.1 to 1.2.5, as suggested here: https://github.com/tzinfo/tzinfo/issues/30
I've been working on this all night. I created a new rails app and tried to install some gems and got "bundler 2 only works with rubygems 2.5". I tried to update --system but got back argument error. I then tried to create another app (I'm not sure if this happened the first time I was busy texting) and it gave "gemfile fileutils" a lot until it said
'''Traceback (most recent call last):
8888: from /home/vagrant/.rbenv/versions/2.5.3/bin/rails:26:in `<main>'
8887: from /home/vagrant/.rbenv/versions/2.5.3/bin/rails:26:in `load'
8886: from /home/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/railties-5.2.3/exe/rails:10:in `<top (required)>'
8885: from /home/vagrant/.rbenv/versions/2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:73:in `require'
8884: from /home/vagrant/.rbenv/versions/2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:73:in `require'
8883: from /home/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/cli.rb:18:in `<top (required)>'
8882: from /home/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/command.rb:46:in `invoke'
8881: from /home/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/command/base.rb:65:in `perform'
... 8876 levels...
4: from /home/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/shell.rb:60:in `say_status'
3: from /home/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/shell/basic.rb:110:in `say_status'
2: from /home/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/shell/basic.rb:390:in `quiet?'
1: from /home/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/core_ext/hash_with_indifferent_access.rb:20:in `[]'
/home/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/core_ext/hash_with_indifferent_access.rb:74:in `convert_key': stack level too deep (SystemStackError)'''
I've tried everything a beginner could from trying to install rubygems every way I could, reinstalled rails, made sure everything was up to date but no luck. I've been working at this for just under 2.5 hours googling and what not so I'm sure there are smaller things I forgot about that I've tried.
I started receiving the following every time i wanted to write any gem command:
Traceback (most recent call last):
8: from C:/Ruby25-x64/bin/gem:9:in `<main>'
7: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
6: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
5: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/gem_runner.rb:86:in `<top (required)>'
4: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems.rb:1140:in `load_plugins'
3: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems.rb:556:in `find_latest_files'
2: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/specification.rb:1156:in `latest_specs'
1: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/specification.rb:1173:in `_latest_specs'
C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/specification.rb:1173:in `sort_by': comparison of Array with String failed (ArgumentError)
I solved the issue. I was actually learning ruby on rails and to cope with the course i started a new rails application with MySQL and started a rails server in the root of the project however it didn't worked because it wasn't able to locate the gem. One of the solutions i found online was to edit the MySQL .gemspec file however it made things worst and suddenly no gem command was running anymore. I solved the issue by uninstalling ruby and then installing it again and also installing the gems again (including rails)
Rails broke on my system and now whenever I run rails new my_app it gives me a weird Thor error.
joshuahadik -> rails new hello_world
Traceback (most recent call last):
21: from /Users/joshuahadik/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `<main>'
20: from /Users/joshuahadik/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `eval'
19: from /Users/joshuahadik/.rvm/gems/ruby-2.5.3/bin/rails:23:in `<main>'
18: from /Users/joshuahadik/.rvm/gems/ruby-2.5.3/bin/rails:23:in `load'
17: from /Users/joshuahadik/.rvm/gems/ruby-2.5.3/gems/railties-5.2.1/exe/rails:10:in `<top (required)>'
16: from /Users/joshuahadik/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
15: from /Users/joshuahadik/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
14: from /Users/joshuahadik/.rvm/gems/ruby-2.5.3/gems/railties-5.2.1/lib/rails/cli.rb:12:in `<top (required)>'
13: from /Users/joshuahadik/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
12: from /Users/joshuahadik/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
11: from /Users/joshuahadik/.rvm/gems/ruby-2.5.3/gems/railties-5.2.1/lib/rails/command.rb:9:in `<top (required)>'
10: from /Users/joshuahadik/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
9: from /Users/joshuahadik/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
8: from /Users/joshuahadik/.rvm/gems/ruby-2.5.3/gems/thor-0.20.1/lib/thor.rb:2:in `<top (required)>'
7: from /Users/joshuahadik/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
6: from /Users/joshuahadik/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
5: from /Users/joshuahadik/.rvm/gems/ruby-2.5.3/gems/thor-0.20.1/lib/thor/base.rb:4:in `<top (required)>'
4: from /Users/joshuahadik/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
3: from /Users/joshuahadik/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
2: from /Users/joshuahadik/.rvm/gems/ruby-2.5.3/gems/thor-0.20.1/lib/thor/error.rb:1:in `<top (required)>'
1: from /Users/joshuahadik/.rvm/gems/ruby-2.5.3/gems/thor-0.20.1/lib/thor/error.rb:6:in `<class:Thor>'
/Users/joshuahadik/.rvm/gems/ruby-2.5.3/gems/thor-0.20.1/lib/thor/error.rb:12:in `<module:DidYouMean>': uninitialized constant Thor::DidYouMean::SpellChecker (NameError)
I get the same error when I run pretty much any rails command, rails -v, rails s, etc.
So far I've tried a few things, including completely removing every version of ruby with rvm, then reinstalling them, then reinstalling the rails gem. Didn't work.
I really have no idea what's going on or why this is happening. Any help would be greatly appreciate.
UPDATE
Just realized that rails still works within the context of an existing rails project. So if I run rails s in the directory of a previously existing rails project it works just fine.
Thor is a gem that is used by Rails to show various command line messages.
It says you are using thor-0.20.1
I believe that version of Thor was released TODAY. The previous version, Thor-0.20.0 was released over a year ago. 0.20.0 is also the version I'm using.
It's likely that there is a bug in thor-0.20.1
You can try using bundler and your Gemfile to force your app to use thor-0.20.0
I ran into the exact same issue and rails wouldn't accept any command (rails s, rails new app) etc. Using ruby 2.5.3 and rails 5.2.1. It is due to the buggy thor-0.20.1
Therefore, reverted it back to thor-0.20.0 by:
- gem uninstall thor (but do not remove the executables when asked)
- gem install thor -v 0.20.1
It shall allow you to create a new project, however keep in mind that the Gemfile.lock file automatically changes the version to thor-0.20.1 (I don't know why). So be sure to change it back again to the 0.20.0.
A new version of thor has been released.
Just run:
gem update thor
The solution for me is delete the version gem Thor:
$ gem uninstall thor
Select gem to uninstall:
1. thor-0.20.0
2. thor-0.20.1
3. All versions
2
Successfully uninstalled thor-0.20.1