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.
Related
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.
A VERY HAPPY AND PROSPEROUS NEW YEAR TO ALL.
I have started learning ROR and trying to create my first application with it. I am trying to use Twitter bootstrap gem. After bundle install, when i am trying to run the rails server command i am getting this error:
/var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter/bootstrap/rails/engine.rb:3:in `require': /var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb:33: syntax error, unexpected ':', expecting kEND (SyntaxError)
Can somebody please guide me what i am missing here ?
here is the stack trace of the same:
/var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter/bootstrap/rails/engine.rb:3:in `require': /var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb:33: syntax error, unexpected ':', expecting kEND (SyntaxError)
I18n.t name, scope: scope
^
from /var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter/bootstrap/rails/engine.rb:3
from /var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter-bootstrap-rails.rb:4:in `require'
from /var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter-bootstrap-rails.rb:4
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `require'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `require'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `each'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `require'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `each'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `require'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler.rb:128:in `require'
from /var/www/ahex_connect/config/application.rb:7
from /var/lib/gems/1.8/gems/railties-3.2.9/lib/rails/commands.rb:53:in `require'
from /var/lib/gems/1.8/gems/railties-3.2.9/lib/rails/commands.rb:53
from /var/lib/gems/1.8/gems/railties-3.2.9/lib/rails/commands.rb:50:in `tap'
from /var/lib/gems/1.8/gems/railties-3.2.9/lib/rails/commands.rb:50
from script/rails:6:in `require'
from script/rails:6
The problem is that you are using Ruby 1.8 while the syntax on line #33 (inside the twitter-bootstrap-rails gem) is from Ruby 1.9. They already fixed this to make it compatible on master. So possible solutions:
Upgrade your Ruby version to 1.9.
Use git version of the gem. Put this to Gemfile (modify the existing line) and run bundle install
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
When I issue the command $ rails s in Aptana Studio's inbuilt command line, it comes up with this error and I don't know how it can be fixed the for the project can be found at https://github.com/nathandunn97/sample_app
=> Booting WEBrick
=> Rails 3.2.8 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/var/lib/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load': /home/nathan/Documents/Aptana Studio 3 Workspace/sample
_application/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end (SyntaxError)
...sion_store :cookie_store, key: '_sample_application_session'
^
from /var/lib/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load'
from /var/lib/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
from /var/lib/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load'
from /var/lib/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:588
from /var/lib/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:587:in `each'
from /var/lib/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:587
from /var/lib/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
from /var/lib/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
from /var/lib/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `run_initializers'
from /var/lib/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
from /var/lib/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
from /var/lib/gems/1.8/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
from /var/lib/gems/1.8/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `send'
from /var/lib/gems/1.8/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/nathan/Documents/Aptana Studio 3 Workspace/sample_application/config/environment.rb:5
from /home/nathan/Documents/Aptana Studio 3 Workspace/sample_application/config.ru:4:in `require'
from /home/nathan/Documents/Aptana Studio 3 Workspace/sample_application/config.ru:4
from /var/lib/gems/1.8/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
from /var/lib/gems/1.8/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
from /home/nathan/Documents/Aptana Studio 3 Workspace/sample_application/config.ru:1:in `new'
from /home/nathan/Documents/Aptana Studio 3 Workspace/sample_application/config.ru:1
The new ruby hash syntax (key:), is only available to ruby 1.9 and beyond. We can see from your log that you are using the 1.8 version.
I just moved a project to another server and seem to be having problems related to the new new hash argument available since Ruby 1.9.2. When I run rails s I get the following error
Exiting
/usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load': /var/www/myapp/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end (SyntaxError) ...sion_store :cookie_store, key: '_myapp_session'
^
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load'
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/engine.rb:556
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/engine.rb:555:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/engine.rb:555
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `run'
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/initializable.rb:55:in `run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/application.rb:96:in `initialize!'
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/railtie/configurable.rb:30:in `send'
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /var/www/myapp/config/environment.rb:5
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
from /var/www/myapp/config.ru:4
from /usr/lib/ruby/gems/1.8/gems/rack-1.3.4/lib/rack/builder.rb:51:in `instance_eval'
from /usr/lib/ruby/gems/1.8/gems/rack-1.3.4/lib/rack/builder.rb:51:in `initialize'
from /var/www/myapp/config.ru:1:in `new'
from /var/www/myapp/config.ru:1
The Error is referencing the following line
Myapp::Application.config.session_store :cookie_store, key: '_myapp_session'
I really don't think the above line of code is the issue. If I remove key: '_myapp_session' or revert it back to the Ruby 1.8.X style I just get the next hash argument error.
I the server I moved to originally had Ruby 1.8.7 running on the server. I have updated ruby to 1.9.3. When I run ruby -v I get ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
I'm not sure why I'm still having the hash issue. Has anyone ran into similar problems?
You may need to check paths, it appears that it is using the rails executable from the 1.8 ruby tree. When you upgrade, you may need to reinstall gems.. This situation is one reason rvm is the preferred way to install ruby.
you should post the code you're suspecting guilty, it's hard to answer with so little clue.
One gotcha about the new style is that you can only use it if ALL the keys on your hash are symbols, this may be the problem.
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'