I'm a beginner trying to learn rails. When i tried to run the "rails test" command, I get this message. I don't understand what this message is :/
rails test
Running via Spring preloader in process 46753
/Users/.../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `require': /Users/..../test/controllers/static_pages_controller_test.rb:26: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError)
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `block in require'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:258:in `load_dependency'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `require'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.1/lib/rails/test_unit/test_requirer.rb:14:in `block in require_files'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.1/lib/rails/test_unit/test_requirer.rb:13:in `each'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.1/lib/rails/test_unit/test_requirer.rb:13:in `require_files'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.1/lib/rails/test_unit/minitest_plugin.rb:94:in `plugin_rails_init'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/minitest-5.10.2/lib/minitest.rb:81:in `block in init_plugins'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/minitest-5.10.2/lib/minitest.rb:79:in `each'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/minitest-5.10.2/lib/minitest.rb:79:in `init_plugins'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/minitest-5.10.2/lib/minitest.rb:130:in `run'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.1/lib/rails/test_unit/minitest_plugin.rb:77:in `run'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/minitest-5.10.2/lib/minitest.rb:63:in `block in autorun'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
The error message is actually telling you exactly where the issue is.
On line 26 of your static_pages_controller_test.rb file, you're missing an end.
...static_pages_controller_test.rb:26: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError)...
It's telling you that you likely have either ommitted an end from your static_pages_controller_test.rb file. Or, you have an extra end in that file.
If you look at the error:
..../test/controllers/static_pages_controller_test.rb:26 syntax error,
unexpected end-of-input, expecting keyword_end (SyntaxError)`
It's telling you that something is amiss on line 26.
Then syntax error, means you have typed something incorrectly.
It then says unexpected end-of-input which means that the parser couldn't figure out where to end the method, and the reason for that is that it was expecting keyword_end, which means there is an end keyword missing.
Related
Hello i'm new to Ruby on Rails, and I was trying to set up a blog.
I ran "rake routes" and I got the error copy and pasted below.
I would greatly appreciate help fixing it (have not found anything similar online.)
dhcp-18-111-5-233:blog ronaldoisabeast$ rake routes
rake aborted!
/Users/ronaldoisabeast/Desktop/Rails/blog/config/routes.rb:58: syntax error, unexpected keyword_end, expecting end-of-input
/Users/ronaldoisabeast/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in load'
/Users/ronaldoisabeast/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:inblock in load'
/Users/ronaldoisabeast/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in load_dependency'
/Users/ronaldoisabeast/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:inload'
/Users/ronaldoisabeast/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
paths'
There is some end missing in your config/routes.rb if you can put it here we will be able to find the bug
This is what happened when I ran rails -v or rails new. Haven't mucked around at all either. I figured i'd post here before trashing the install and re-installing rails.
Assuming my install is shot
/Users/fugazy/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:112:in `require': /Users/fugazy/.rvm/gems/ruby-1.9.3-p392/gems/rails-0.13.1/lib/rails_generator/options.rb:124: syntax error, unexpected '[', expecting '|' (SyntaxError)
...make any changes.') { |options[:pretend]| }
... ^
/Users/fugazy/.rvm/gems/ruby-1.9.3-p392/gems/rails-0.13.1/lib/rails_generator/options.rb:127: syntax error, unexpected '[', expecting '|'
...ss normal output.') { |options[:quiet]| }
... ^
/Users/fugazy/.rvm/gems/ruby-1.9.3-p392/gems/rails-0.13.1/lib/rails_generator/options.rb:128: syntax error, unexpected '[', expecting '|'
...ktrace on errors.') { |options[:backtrace]| }
... ^
/Users/fugazy/.rvm/gems/ruby-1.9.3-p392/gems/rails-0.13.1/lib/rails_generator/options.rb:129: syntax error, unexpected '[', expecting '|'
...his help message.') { |options[:help]| }
... ^
from /Users/fugazy/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:112:in `require'
from /Users/fugazy/.rvm/gems/ruby-1.9.3-p392/gems/rails-0.13.1/lib/rails_generator/base.rb:1:in `<top (required)>'
from /Users/fugazy/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:112:in `require'
from /Users/fugazy/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:112:in `require'
from /Users/fugazy/.rvm/gems/ruby-1.9.3-p392/gems/rails-0.13.1/lib/rails_generator.rb:34:in `<top (required)>'
from /Users/fugazy/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:112:in `require'
from /Users/fugazy/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:112:in `require'
from /Users/fugazy/.rvm/gems/ruby-1.9.3-p392/gems/rails-0.13.1/bin/rails:14:in `<top (required)>'
from /Users/fugazy/.rvm/gems/ruby-1.9.3-p392/bin/rails:19:in `load'
from /Users/fugazy/.rvm/gems/ruby-1.9.3-p392/bin/rails:19:in `<main>'
from /Users/fugazy/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/fugazy/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `<main>'
My buddy didn't have rails in that directory, I fixed that. Didn't realize it until #benjamin Sinclaire pointed out the versions #.
I am trying to learn Ruby by following the railstutorial.org website. I am at the automated tests part, running Guard but it throws an error:
C:\Users\Thomas\Documents\Development\teachmtg.com [master]> bundle exec guard
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.1/lib/guard/dsl.rb:119:in `instance_eval': C:/Users/Thomas/Documents/Development/teachmtg.com/Guardfile:4: syntax error, unexpected ',' (SyntaxError)
guard 'rspec', :version => 2 do, :all_after_pass => false do
^
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.1/lib/guard/dsl.rb:119:in `instance_eval_guardfile'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.1/lib/guard/dsl.rb:74:in `evaluate_guardfile'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.1/lib/guard.rb:147:in `setup_from_guardfile'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.1/lib/guard.rb:63:in `setup'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.1/lib/guard.rb:188:in `start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.1/lib/guard/cli.rb:110:in `start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.1/bin/guard:6:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/bin/guard:23:in `load'
from C:/RailsInstaller/Ruby1.9.3/bin/guard:23:in `<main>'
As I am completely new to Ruby and Rails, I have no idea where to look, what to look for, etc.
Can you give me a few tips and pointers ?
Thanks !
Remove do from :version => 2 do, :all_after_pass ... expression in Guardfile.
I'm recently began working on a project which I've cloned from github.
Everytime I try start the rails server I get the following error:
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in load': /Users/thomas/Projects/BillingMiddleware/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end (SyntaxError)
...sion_store :cookie_store, key: '_BillingMiddleware_session'
^
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:inload'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in load_dependency'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:inload'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/engine.rb:588
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/engine.rb:587:in each'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/engine.rb:587
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:30:ininstance_exec'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:30:in run'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:55:inrun_initializers'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:54:in each'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:54:inrun_initializers'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/application.rb:136:in initialize!'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:insend'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in method_missing'
from /Users/thomas/Projects/BillingMiddleware/config/environment.rb:5
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:inrequire'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in require'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:inload_dependency'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in require'
from /Users/thomas/Projects/BillingMiddleware/config.ru:4
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:51:ininstance_eval'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:51:in initialize'
from /Users/thomas/Projects/BillingMiddleware/config.ru:1:innew'
from /Users/thomas/Projects/BillingMiddleware/config.ru:1
My collegue is also working on the project and doesn't seem to have any problems starting the server. He is running the same version of ruby, rails and WeBrick as me.
I've tried changing the syntax from key: to :key =>, this shouldn't be the problem though as I am running ruby version 1.9.3. If I make that change anyhow I get a different error message:
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `load': /Users/thomas/Projects/BillingMiddleware/config/initializers/wrap_parameters.rb:8: syntax error, unexpected ':', expecting kEND (SyntaxError)
wrap_parameters format: [:json]
^
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `load'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `load'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/engine.rb:588
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/engine.rb:587:in `each'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/engine.rb:587
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `run'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:55:in `run_initializers'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `each'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/application.rb:136:in `initialize!'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `send'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/thomas/Projects/BillingMiddleware/config/environment.rb:5
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /Users/thomas/Projects/BillingMiddleware/config.ru:4
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
from /Users/thomas/Projects/BillingMiddleware/config.ru:1:in `new'
from /Users/thomas/Projects/BillingMiddleware/config.ru:1
I've tired completely removing and re-installing rvm, ruby and rails several times to no prevail. I’ve also tried running bundle install which hasn’t help.
Does anyone have any idea of what’s going wrong?
Thanks
Try changing your hashes to :key => :value syntax. The same error and fixes are discussed at Rails 3.1 Deployment to Heroku Error.
The temp fixes suggested are:
config/initializers/session_store.rb
App::Application.config.session_store :cookie_store, :key => '_BillingMiddleware_session'
config/initializers/wrap_parameters.rb
ActionController::Base.wrap_parameters :format => [:json]
Looks like hash syntax on another line, after you fixed that one. Check config/intializers/wrap_parameters.rb and i wonder if this project got the flag to "not" use the new syntax?
I am getting the following error when I use Candy in my Rails project. Really a syntax error?
=> Ctrl-C to shutdown server
Exiting
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require': /home/waleed/.bundler/ruby/1.8/candy-daa2670a71e3/lib/candy/array.rb:56: syntax error, unexpected ':', expecting kEND (SyntaxError)
...lection.find_and_modify query: {"_id" => #__candy_parent.id}...
^
/home/waleed/.bundler/ruby/1.8/candy-daa2670a71e3/lib/candy/array.rb:56: syntax error, unexpected ',', expecting kEND
...{"_id" => #__candy_parent.id}, update: {'$pop' => {#__candy_...
^
/home/waleed/.bundler/ruby/1.8/candy-daa2670a71e3/lib/candy/array.rb:56: syntax error, unexpected ',', expecting kEND
... {#__candy_parent_key => -1}}, new: false
^
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from /home/waleed/.bundler/ruby/1.8/candy-daa2670a71e3/lib/candy/piece.rb:1
Any ideas why?
Per the project's GitHub page, the Candy gem only works on Ruby 1.9 -- you're using 1.8.