1

When I start my rails server with commmand "ruby script/rails server webrick -e development -p 9000", it is not working.

I think my activesupport gem requires ruby 1.9.3 but I already installed this version. (Ruby - 1.8.7 , Rails - 3.2.16, gem - 1.8.15)

Please guide me how to solve this.

My Error is showing as below:

sayem@sayem-Lenovo-IdeaPad-U410:~/nProject$ ruby script/rails server webrick -e development -p 9000
/var/lib/gems/1.8/gems/bundler-1.10.6/lib/bundler/shared_helpers.rb:80: warning: Insecure world writable dir /var/lib/gems/1.8 in PATH, mode 040777
=> Booting WEBrick
=> Rails 3.2.16 application starting in development on http://0.0.0.0:9000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:469:in `load': /home/sayem/nProject/app/models/issue.rb:47: syntax error, unexpected ':', expecting ')' (SyntaxError)
...ise_tasks,   where(tracker_id: 4).order('created_on ASC')
                              ^
/home/sayem/nProject/app/models/issue.rb:48: syntax error, unexpected ':', expecting ')'
...ise_issues,  where(tracker_id: 5).order('created_on ASC')
                              ^
/home/sayem/nProject/app/models/issue.rb:112: syntax error, unexpected kDO_BLOCK, expecting kEND
...ser, :view_issues, options) do |role, user|
                              ^
/home/sayem/nProject/app/models/issue.rb:112: syntax error, unexpected '|', expecting '='
/home/sayem/nProject/app/models/issue.rb:134: syntax error, unexpected kDO_BLOCK, expecting kEND
...:view_issues, self.project) do |role, user|
                              ^
/home/sayem/nProject/app/models/issue.rb:134: syntax error, unexpected '|', expecting '='
/home/sayem/nProject/app/models/issue.rb:150: syntax error, unexpected kEND, expecting $end
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:469:in `load_file'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:639:in `new_constants_in'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:468:in `load_file'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:353:in `require_or_load'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:313:in `depend_on'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:225:in `require_dependency'
    from /home/sayem/nProject/plugins/redmine_contacts/lib/redmine_contacts/patches/issue_patch.rb:20
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:469:in `load'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:469:in `load_file'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:639:in `new_constants_in'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:468:in `load_file'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:353:in `require_or_load'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:313:in `depend_on'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:225:in `require_dependency'
    from /home/sayem/nProject/plugins/redmine_contacts/lib/redmine_contacts.rb:27:in `_callback_before_65'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/callbacks.rb:429:in `_run__2051399600__prepare__4__callbacks'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/callbacks.rb:405:in `send'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/callbacks.rb:405:in `__run_callback'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/callbacks.rb:81:in `send'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/callbacks.rb:81:in `run_callbacks'
    from /var/lib/gems/1.8/gems/actionpack-3.2.16/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
    from /var/lib/gems/1.8/gems/actionpack-3.2.16/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
    from /var/lib/gems/1.8/gems/railties-3.2.16/lib/rails/application/finisher.rb:47
    from /var/lib/gems/1.8/gems/railties-3.2.16/lib/rails/initializable.rb:30:in `instance_exec'
    from /var/lib/gems/1.8/gems/railties-3.2.16/lib/rails/initializable.rb:30:in `run'
    from /var/lib/gems/1.8/gems/railties-3.2.16/lib/rails/initializable.rb:55:in `run_initializers'
    from /var/lib/gems/1.8/gems/railties-3.2.16/lib/rails/initializable.rb:54:in `each'
    from /var/lib/gems/1.8/gems/railties-3.2.16/lib/rails/initializable.rb:54:in `run_initializers'
    from /var/lib/gems/1.8/gems/railties-3.2.16/lib/rails/application.rb:136:in `initialize!'
    from /var/lib/gems/1.8/gems/railties-3.2.16/lib/rails/railtie/configurable.rb:30:in `send'
    from /var/lib/gems/1.8/gems/railties-3.2.16/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /home/sayem/nProject/config/environment.rb:14
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `require'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `require'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /var/lib/gems/1.8/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `require'
    from /home/sayem/nProject/config.ru:3
    from /var/lib/gems/1.8/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
    from /var/lib/gems/1.8/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
    from /home/sayem/nProject/config.ru:0:in `new'
    from /home/sayem/nProject/config.ru:0
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
  • are you not using `Bundler`? – K M Rakibul Islam Aug 15 '15 at 06:41
  • Please get the gemfile and development.log from the link below - https://drive.google.com/folderview?id=0Bz6SndjGGslqfndwMmhDbzUya1A1RjJNa29DVG9YSmJiTVNwY1JMMnRpbldzdjF2SmYzTWM&usp=sharing – Sayem Chowdhury Aug 15 '15 at 06:41
  • You can just edit/update your question and paste the `Gemfile` and log – K M Rakibul Islam Aug 15 '15 at 06:42
  • i used bundle install command for many times but whenever i start my server , it is showing activesupport error in the path -> /var/lib/gems/1.8/gems/ – Sayem Chowdhury Aug 15 '15 at 06:42
  • you know, the file contains more lines. So, can't paste it here.. you can collect the gemfile and log from my Gdrive link.......... https://drive.google.com/folderview?id=0Bz6SndjGGslqfndwMmhDbzUya1A1RjJNa29DVG9YSmJiTVNwY1JMMnRpbldzdjF2SmYzTWM&usp=sharing – Sayem Chowdhury Aug 15 '15 at 06:44
  • Can you paste the contents of this file? `imeetdashboard/app/controllers/imdashs_controller.rb` Looks like there is an error: `syntax error, unexpected ')', expecting kEND)` I think problem is there. Please paste the file and I will take a look and tell you how to fix. – K M Rakibul Islam Aug 15 '15 at 07:26
  • Yes Sure... imeet model file is attached in link - https://drive.google.com/drive/folders/0Bz6SndjGGslqfndwMmhDbzUya1A1RjJNa29DVG9YSmJiTVNwY1JMMnRpbldzdjF2SmYzTWM – Sayem Chowdhury Aug 15 '15 at 07:30
  • Please look at this question for example: http://stackoverflow.com/questions/32022243/rails-cant-render-pages-getting-json-parse-error It shows how to paste a big log file in your question section. You have to provide your codes in your question section because that's the way of doing thing at StackOverflow. – K M Rakibul Islam Aug 15 '15 at 07:32
  • You should do that in your question section NOT in the answer section. Please delete it from the answer and paste in the question section (by editing) the same way. – K M Rakibul Islam Aug 15 '15 at 07:42
  • i don't see any question section button like answer section.. i think i should have pasted that code at the very beginning.. Can you suggest? – Sayem Chowdhury Aug 15 '15 at 07:50
  • I have found the issue and posted my answer. Take a look and accept the answer once the problem is resolved. – K M Rakibul Islam Aug 15 '15 at 07:54
  • Look I edited your question section and uploaded a picture where the arrow shows the `edit` button. You can always click that button and edit your question to provide more relevant information so that people can help effectively. – K M Rakibul Islam Aug 15 '15 at 08:01

1 Answers1

0

So, the problem is you are using Ruby version 1.8.7 and in that version you have to define a hash like this: :key => value

But, in your imdashs_controller.rb file you have several places (e.g. line number 67, 68, 69 and MORE) you have used Ruby's 1.9 hash syntax (key: value).

So, if you change the hash syntax to :key => value (as you are running Ruby 1.8.7) like below for all the hashes, your problem will be solved and then you will be able run your rails server (unless there is another different problem).

Update

Change all the occurrences of Ruby 1.9 hash syntaxes (key: value) to :key => value in your project.

K M Rakibul Islam
  • 33,760
  • 12
  • 89
  • 110
  • I did it.... but the error is something that is related to activesupport gems... It is related to Ruby 1.9.3.. i installed Ruby 1.9.3 but still it is showing 1.8.7....... I used command rvm use --default 1.9.3.... But it's not setting to the 1.9.3 – Sayem Chowdhury Aug 15 '15 at 08:06
  • You still have many `1.9` hash syntax in your project. The error log is also showing that. For example: `/home/sayem/nProject/app/models/issue.rb:47` (line no: `47`) has the same problem. Looks like in your `Issue` model has more same problem. You have to change all of your hash syntaxes in your project from `key: value` TO `:key => value` format. – K M Rakibul Islam Aug 15 '15 at 08:26
  • Isn't it better to upgrade Ruby version => 1.9.3 rather to make changes key:pair values..... I am worried i have installed 1.9.3 but not showing / activating this version... :( – Sayem Chowdhury Aug 15 '15 at 08:43
  • of course. do an upgrade. I thought you wanted to use `1.8.7` – K M Rakibul Islam Aug 15 '15 at 08:44
  • I have installed Ruby 2.2.1 but still 1.8.7 is showing... even though i used cmd - rvm use -default 2.2.1... But fact remains the same :( – Sayem Chowdhury Aug 15 '15 at 08:50
  • In your terminal, ` $ rvm list` will show what ruby version is currently in use. What does it show? – Mauddev Aug 15 '15 at 09:17
  • sayem@sayem-Lenovo-IdeaPad-U410:~/nProject$ rvm list ruby-1.9.3-p484 is not installed. To install do: 'rvm install ruby-1.9.3-p484' rvm rubies =* ruby-2.2.1 [ x86_64 ] # => - current # =* - current && default # * - default – Sayem Chowdhury Aug 15 '15 at 09:39
  • Are you sure you used rvm to install 1.9.3 ? You need to do `$ rvm install 1.9.3` before you can `$ rvm use 1.9.3` – Mauddev Aug 15 '15 at 11:04
  • rvm use 1.9.3 cmd works when i change settings "run as login shell" in terminal and exit .. then restart the command... Ofcourse i have to run "bundle install" after that....... Thanks Mauddev for your suggestion and Ofcourse Rakibul for your kind patience and co-operation.... :) System is working NOW... – Sayem Chowdhury Aug 15 '15 at 15:09
  • @SayemChowdhury glad to hear that your system is working now. You should consider accepting my answer if that helped you :) – K M Rakibul Islam Aug 15 '15 at 18:55
  • I also recommend you reading some posts on how to contribute/format questions on stackoverflow. That would help you and others as well. e.g. http://meta.stackexchange.com/questions/18614/style-guide-for-questions-and-answers – K M Rakibul Islam Aug 15 '15 at 19:01
  • @Mr. Rakibul.............Yeah Sure...How can i contact you BRO?.. Skype/hangouts? – Sayem Chowdhury Aug 16 '15 at 04:46
  • @SayemChowdhury email me: rakib1987@gmail.com We can take it from there. – K M Rakibul Islam Aug 16 '15 at 04:56
  • @SayemChowdhury you should accept the answer if that helped you towards solving your problem. To know more about accepting an answer, please see this: http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – K M Rakibul Islam Aug 16 '15 at 08:52
  • @SayemChowdhury did you get the chance to accept my answer? Please see this post to know more about how accepting answers work: http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work Thanks. – K M Rakibul Islam Aug 31 '15 at 10:23