Psych::SyntaxError when trying to run obtvse on Mac OS X - ruby-on-rails

What am i doing wrong? bundle install runs fine, ruby is at 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.0.0]. Tried to replace psych with syck already but it throws the exact same errors.
rMBP:obtvse Tobias$ rails s
=> Booting Thin
=> Rails 3.2.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/Tobias/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/psych.rb:203:in `parse':
(<unknown>): found character that cannot start any token while scanning for the next
token at line 7 column 22 (Psych::SyntaxError)
from /Users/Tobias/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/psych.rb:203:in
`parse_stream'
from /Users/Tobias/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/psych.rb:151:in `parse'
from /Users/Tobias/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/psych.rb:127:in `load'
from /Users/Tobias/Dropbox/obtvse/config/initializers/config.rb:1:in `<top (required)>'
from /Users/Tobias/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-
(...)

Related

ruby 3.0.4, redmine 5.0.0, rails 6.1.4, test install start with webrick fails, "wrong number of arguments"

New ubuntu-20 system with the following:
ruby 3.0.4
rails 6.1.4
redmine 5.0.0
After install, trying to start webrick test server:
bundle exec rails server webrick -e redmine_test
fails with:
/home/test_user/.gem/ruby/3.0.4/gems/thor-1.2.1/lib/thor/base.rb:525:in `handle_argument_error':
ERROR: "rails server" was called with arguments ["webrick"] (Thor::InvocationError)
Usage: "rails server -u [thin/puma/webrick] [options]"
from .../thor-1.2.1/lib/thor/command.rb:34:in `rescue in run'
from .../thor-1.2.1/lib/thor/command.rb:20:in `run'
from .../thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
from .../thor-1.2.1/lib/thor.rb:392:in `dispatch'
from .../railties-6.1.4.7/lib/rails/command/base.rb:69:in `perform'
from .../railties-6.1.4.7/lib/rails/command.rb:48:in `invoke'
from .../railties-6.1.4.7/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
.../railties-6.1.4.7/lib/rails/commands/server/server_command.rb:130:in `perform':
wrong number of arguments (given 1, expected 0) (ArgumentError)
from .../thor-1.2.1/lib/thor/command.rb:27:in `run'
from .../thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
from .../thor-1.2.1/lib/thor.rb:392:in `dispatch'
from .../railties-6.1.4.7/lib/rails/command/base.rb:69:in `perform'
from .../railties-6.1.4.7/lib/rails/command.rb:48:in `invoke'
from .../railties-6.1.4.7/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
It's not clear to me which arguments / syntax it's complaining about; I've tried different combinations and all complain about wrong number of arguments:
bundle exec rails server webrick -e redmine_test (given 1, expected 0)
bundle exec rails server webrick -e=redmine_test (given 1, expected 0)
RAILS_ENV=redmine_test bundle exec rails server webrick (given 1, expected 0)
bundle exec rails server webrick redmine_test (given 2, expected 0)
bundle exec rails server webrick (given 1, expected 0)
The command-line format seems to have changed for Rails 6:
> rails server --help
Usage:
rails server -u [thin/puma/webrick] [options]
^^
You may also need to add webrick to your Gemfile:
bundle add webrick
Casper showed that solution and I am rearranging the solution point by point here.
Add webrick if it's not already installed. bundle add webrick
Run bundle exec rails server -u webrick -e redmine_test
Look at the last keyword redmine_test. It's the enviroment that you are using for this case. So, write production if you are trying to run it in production.

Ruby Rails - Cloud9 - (SocketError)

When trying to start my Rails app in C9.io, I see the Socket Error below. I am unsure how to correct this issue. Any ideas?
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
Rails 4.2.5
Cloud9 IDE
blacknight659:~/jh_projects/mybay2 $ rails s -b -$IP -p -$PORT
=> Booting WEBrick
=> Rails 4.2.5 application starting in development on http://-0.0.0.0:-8080
=> Run rails server -h for more startup options
=> Ctrl-C to shutdown server
[2016-07-26 17:43:06] INFO WEBrick 1.3.1
[2016-07-26 17:43:06] INFO ruby 2.3.0 (2015-12-25) [x86_64-linux]
Exiting
/usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/socket.rb:231:in getaddrinfo': getaddrinfo: Servname not supported for ai_socktype (SocketError)
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/socket.rb:231:inforeach'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/socket.rb:757:in tcp_server_sockets'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/utils.rb:65:increate_listeners'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/server.rb:134:in listen'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/server.rb:115:ininitialize'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/httpserver.rb:47:in initialize'
from /usr/local/rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:31:innew'
from /usr/local/rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:31:in run'
from /usr/local/rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/server.rb:286:instart'
from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands/server.rb:80:in start'
from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:80:inblock in server'
from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in tap'
from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:inserver'
from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in run_command!'
from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands.rb:17:in'
from /home/ubuntu/jh_projects/mybay2/bin/rails:9:in require'
from /home/ubuntu/jh_projects/mybay2/bin/rails:9:in'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in load'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:incall'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/command.rb:7:in call'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client.rb:30:inrun'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/bin/spring:49:in <top (required)>'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:inload'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in <top (required)>'
from /home/ubuntu/jh_projects/mybay2/bin/spring:13:inrequire'
from /home/ubuntu/jh_projects/mybay2/bin/spring:13:in <top (required)>'
from bin/rails:3:inload'
from bin/rails:3:in `'
I got the same error when tried to start my Sinatra app on cloud9. It turned out that I was running the command : $ bundle exec rackup -p $PORT -o $IP with root user (su). Try to run it on normal user.
You have a dash before ip and port arguments. The values of the arguments are specified without dashes. Try:
rails s -b $IP -p $PORT

Error when run server rails 2.3.5 with memcached

I use ruby version 1.8.7, gem version 1.3.5, rails version 2.3.5 and memcache. I get this error when I run server
phuongnm-lap:~/trunk/hurricane$ ruby script/server
=> Booting Mongrel
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
/home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require': /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/get_process_mem-0.2.0/lib/get_process_mem.rb:60: undefined (?...) sequence: /(?<value>(\d*\.{0,1}\d+))\s+(?<unit>\w\w)/ (SyntaxError)
from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require'
from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `require'
from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from ./script/../config/boot.rb:41:in `load_gems'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:164:in `process'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
from /home/asiantech/trunk/hurricane/config/environment.rb:34
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/rails-2.3.5/lib/commands/server.rb:84
from script/server:3:in `require'
from script/server:3
please help me!
Your ruby version is too old for the get_process_mem gem to run. The gem uses a complex regular expression to parse information from /proc files on your linux server. However, ruby 1.8.7 does not support such complex regexp yet.
You can see for yourself in irb. In ruby 1.8.7 the match fails:
"aaa" =~ /(?<value>(\d*\.{0,1}\d+))\s+(?<unit>\w\w)/
# => SyntaxError: compile error
# => (irb):1: undefined (?...) sequence: /(?<value>(\d*\.{0,1}\d+))\s+(?<unit>\w\w)/
whereas under ruby 2.2 it works ok (does not return anything in this test case, but more importantly, does not fail with error):
"aaa" =~ /(?<value>(\d*\.{0,1}\d+))\s+(?<unit>\w\w)/
# => nil
You have a few options now:
Upgrade to a newer ruby (and rails) if you can, you won't have to solve these elderly code-related problems and won't be using an unsupported ruby/rails version any more, but nevertheless this is rather a cumbersome process.
Get rid of the get_process_mem gem. You can see the same info, i.e. the memory consumed by the process, using command line utilities, without needing to install any gem. Try the top or htop commands for example.

'Rails' with Activesupport 3.2.0

I'm a new user of Ruby on rails and I try now to create my owen blog to practice this beautiful framework.
So, after I did this commande to start server I got this error , and I thought that from ActiveSupport.
I need a help :)
The is the message error that I got :
~/Bureau/blog$ rails server
=> Booting WEBrick
=> Rails 3.2.0.rc2 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/lib/ruby/gems/1.8/gems/activesupport-3.2.0.rc2/lib/active_support/dependencies.rb:245:in `load': /home/eayoub/Bureau/blog/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end (SyntaxError)
...sion_store :cookie_store, key: '_blog_session'
^
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.0.rc2/lib/active_support/dependencies.rb:245:in `load'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.0.rc2/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.0.rc2/lib/active_support/dependencies.rb:245:in `load'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/engine.rb:588
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/engine.rb:587:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/engine.rb:587
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/initializable.rb:30:in `run'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/initializable.rb:55:in `run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/initializable.rb:54:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/application.rb:136:in `initialize!'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/railtie/configurable.rb:30:in `send'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/eayoub/Bureau/blog/config/environment.rb:5
from /home/eayoub/Bureau/blog/config.ru:4:in `require'
from /home/eayoub/Bureau/blog/config.ru:4
from /usr/lib/ruby/gems/1.8/gems/rack-1.4.0/lib/rack/builder.rb:51:in `instance_eval'
from /usr/lib/ruby/gems/1.8/gems/rack-1.4.0/lib/rack/builder.rb:51:in `initialize'
from /home/eayoub/Bureau/blog/config.ru:1:in `new'
from /home/eayoub/Bureau/blog/config.ru:1
Looks like you are running on Ruby 1.8.7, but the code you have written is only valid in Ruby 1.9.
If possible, I would recommend upgrading up to 1.9.3; that should fix the issue.
If you cannot use Ruby 1.9.3, just change the line from
key: '_blog_session'
to
:key=>'_blog_session'
Are you running Ruby 1.9.x? The error is on a line using the new 1.9 hash syntax which is not backwards compatible. Try running ruby --v and seeing what version you're running. If its a 1.8.x you'll need to upgrade Ruby in order to run the latest version of Rails.

How to fix error in Linguistics library in Rails 3.1 and Ruby 1.9.2

My application has had the following lines without any trouble in recent versions of rails:
gem 'linguistics' # in Gemfile
Linguistics::use(:en, :installProxy => :en) # In environment.rb
Recently I upgraded from Ruby 1.8.7 to Ruby 1.9.2 and am using the edge version of Rails. When I start the server I now see the following:
=> Booting WEBrick
=> Rails 3.1.0.beta1 application starting in development on
http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server Exiting /Users/alextan/.rvm/gems/ruby-1.9.2-p180/gems/linguistics-1.0.8/lib/linguistics.rb:177:in
`en': can't modify frozen object
(RuntimeError) from (eval):6:in
`method_missing' from
/Users/alextan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.beta1/lib/rails/commands/server.rb:78:in
`middleware' from
/Users/alextan/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.3.0.beta/lib/rack/server.rb:291:in
`build_app' from
/Users/alextan/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.3.0.beta/lib/rack/server.rb:301:in
`wrapped_app' from
/Users/alextan/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.3.0.beta/lib/rack/server.rb:252:in
`start' from
/Users/alextan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.beta1/lib/rails/commands/server.rb:69:in
`start' from
/Users/alextan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.beta1/lib/rails/commands.rb:53:in
`block in <top (required)>' from
/Users/alextan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.beta1/lib/rails/commands.rb:48:in
`tap' from
/Users/alextan/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.beta1/lib/rails/commands.rb:48:in
`<top (required)>' from
script/rails:6:in `require' from
script/rails:6:in `<main>'
Any idea on how I can fix this? Is this an incompatibility between Linguistics and Ruby 1.9.2?
I think its mainly a rails compatibility problem, because in the commits 1.9.2 compat is mentioned, try on after another, not both together, to ensure, 1.9.2 and rails 3 works, after that switch to edge rails.
You may want to try, if there is a actual version out there, try (include this version then in your gemfile):
gem update linguistics --pre
OR be sure to have it updated in your gemfile
gem 'linguistics', :git => 'https://github.com/ged/linguistics.git'

Resources