I just stuck to searching my error when try to get my Rails version, anyone can help to solve this:
C:\Ruby24\bin>ruby -v ruby 2.4.1p111 (2017-03-22 revision 58053)
[i386-mingw32]
C:\Ruby24\bin>gem -v
2.6.12
C:\Ruby24\bin>rails -v
C:/Ruby24/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require':
C:/Ruby24/lib/ruby/gems/2.4.0/gems/activesupport-5.1.3/lib/active_support/core_ext/hash/deep_merge.rb:6: syntax error, unexpected keyword_end, expecting end-of-input (SyntaxError) end
^
from C:/Ruby24/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby24/lib/ruby/gems/2.4.0/gems/activesupport-5.1.3/lib/active_support/i18n.rb:1:in `<top (required)>'
from C:/Ruby24/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby24/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby24/lib/ruby/gems/2.4.0/gems/activesupport-5.1.3/lib/active_support/inflector/inflections.rb:4:in `<top (required)>'
from C:/Ruby24/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby24/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby24/lib/ruby/gems/2.4.0/gems/activesupport-5.1.3/lib/active_support/inflections.rb:1:in `<top (required)>'
from C:/Ruby24/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby24/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby24/lib/ruby/gems/2.4.0/gems/activesupport-5.1.3/lib/active_support/inflector/methods.rb:1:in `<top (required)>'
from C:/Ruby24/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby24/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby24/lib/ruby/gems/2.4.0/gems/activesupport-5.1.3/lib/active_support/dependencies/autoload.rb:1:in `<top (required)>'
from C:/Ruby24/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby24/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby24/lib/ruby/gems/2.4.0/gems/activesupport-5.1.3/lib/active_support.rb:25:in `<top (required)>'
from C:/Ruby24/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby24/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby24/lib/ruby/gems/2.4.0/gems/railties-5.1.3/lib/rails/command.rb:1:in `<top (required)>'
from C:/Ruby24/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby24/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby24/lib/ruby/gems/2.4.0/gems/railties-5.1.3/lib/rails/cli.rb:10:in `<top (required)>'
from C:/Ruby24/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby24/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby24/lib/ruby/gems/2.4.0/gems/railties-5.1.3/exe/rails:9:in `<top (required)>'
from C:/Ruby24/bin/rails:23:in `load'
from C:/Ruby24/bin/rails:23:in `<main>'
I ran Windows 7.
May be the gem rails not installed properly. Installing rails will solve the issue. It worked for me.
gem install rails
Related
When I try to create a new project by running:
rails new app
I get the following error message:
/usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:121:in `require': /usr/lib/ruby/vendor_ruby/did_you_mean/spell_checkers/method_name_checker.rb:9: syntax error, unexpected '.' (SyntaxError)
#has_args = !exception.args&.empty?
^
from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:121:in `require'
from /usr/lib/ruby/vendor_ruby/did_you_mean.rb:6:in `<top (required)>'
from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:121:in `require'
from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:121:in `require'
from /var/lib/gems/2.2.0/gems/thor-0.20.3/lib/thor/error.rb:4:in `<class:Thor>'
from /var/lib/gems/2.2.0/gems/thor-0.20.3/lib/thor/error.rb:1:in `<top (required)>'
from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /var/lib/gems/2.2.0/gems/thor-0.20.3/lib/thor/base.rb:4:in `<top (required)>'
from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /var/lib/gems/2.2.0/gems/thor-0.20.3/lib/thor.rb:2:in `<top (required)>'
from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:121:in `require'
from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:121:in `require'
from /var/lib/gems/2.2.0/gems/railties-5.1.4/lib/rails/command.rb:7:in `<top (required)>'
from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /var/lib/gems/2.2.0/gems/railties-5.1.4/lib/rails/cli.rb:10:in `<top (required)>'
from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /var/lib/gems/2.2.0/gems/railties-5.1.4/exe/rails:9:in `<top (required)>'
from /usr/local/bin/rails:23:in `load'
from /usr/local/bin/rails:23:in `<main>'
I'm not sure what's going on. What's this?
The safe navigation operator &. is invalid in Ruby < 2.3. And you are using Ruby 2.2. That is the cause of the syntax error.
Try to use rvm and then install rails.
rvm install 2.5.0
Reference : https://rvm.io/rvm/install
I pulled the latest code, and did bundle install. After that when i start the server I am getting the following error.
prashanth#prashanth-OptiPlex-390:~/proj/ysignup$ rails s
/home/prashanth/.gems/gems/activesupport-4.2.10/lib/active_support/i18n.rb:13:in `<top (required)>': uninitialized constant I18n (NameError)
from /home/prashanth/.gems/gems/activesupport-4.2.10/lib/active_support/inflector/inflections.rb:3:in `require'
from /home/prashanth/.gems/gems/activesupport-4.2.10/lib/active_support/inflector/inflections.rb:3:in `<top (required)>'
from /home/prashanth/.gems/gems/activesupport-4.2.10/lib/active_support/inflections.rb:1:in `require'
from /home/prashanth/.gems/gems/activesupport-4.2.10/lib/active_support/inflections.rb:1:in `<top (required)>'
from /home/prashanth/.gems/gems/activesupport-4.2.10/lib/active_support/inflector/methods.rb:3:in `require'
from /home/prashanth/.gems/gems/activesupport-4.2.10/lib/active_support/inflector/methods.rb:3:in `<top (required)>'
from /home/prashanth/.gems/gems/activesupport-4.2.10/lib/active_support/dependencies/autoload.rb:1:in `require'
from /home/prashanth/.gems/gems/activesupport-4.2.10/lib/active_support/dependencies/autoload.rb:1:in `<top (required)>'
from /home/prashanth/.gems/gems/activesupport-4.2.10/lib/active_support.rb:25:in `require'
from /home/prashanth/.gems/gems/activesupport-4.2.10/lib/active_support.rb:25:in `<top (required)>'
from /home/prashanth/.gems/gems/actionpack-4.2.10/lib/action_dispatch.rb:24:in `require'
from /home/prashanth/.gems/gems/actionpack-4.2.10/lib/action_dispatch.rb:24:in `<top (required)>'
from /home/prashanth/.gems/gems/railties-4.2.10/lib/rails/commands/server.rb:3:in `require'
from /home/prashanth/.gems/gems/railties-4.2.10/lib/rails/commands/server.rb:3:in `<top (required)>'
from /home/prashanth/.gems/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:123:in `require'
from /home/prashanth/.gems/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:123:in `require_command!'
from /home/prashanth/.gems/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:73:in `server'
from /home/prashanth/.gems/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/prashanth/.gems/gems/railties-4.2.10/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
prashanth#prashanth-OptiPlex-390:~/proj/ysignup$
Here is the Gemfile:
gem 'rails-i18n'
I'm trying to run my ruby script, but I keep getting this error. I've tried reinstalling ruby and rails. ruby version is 2.3.3 and rails is 4.2.5. any ideas?
ruby firebasepushserver.rb
/Users/paulyang/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require': incompatible library version - /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/json-2.1.0/lib/json/ext/parser.bundle (fatal)
from /Users/paulyang/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/json-2.1.0/lib/json/ext.rb:7:in `<module:Ext>'
from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/json-2.1.0/lib/json/ext.rb:6:in `<module:JSON>'
from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/json-2.1.0/lib/json/ext.rb:3:in `<top (required)>'
from /Users/paulyang/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/paulyang/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/json-2.1.0/lib/json.rb:59:in `<module:JSON>'
from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/json-2.1.0/lib/json.rb:55:in `<top (required)>'
from /Users/paulyang/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/paulyang/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/pg-0.20.0/lib/pg/text_encoder.rb:3:in `<top (required)>'
from /Users/paulyang/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/paulyang/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/pg-0.20.0/lib/pg.rb:63:in `<module:PG>'
from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/pg-0.20.0/lib/pg.rb:35:in `<top (required)>'
from /Users/paulyang/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `require'
from /Users/paulyang/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
from /Users/paulyang/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from firebasepushserver.rb:4:in `<main>'
When trying to run rails g rails_admin:install I get the following error:
/home/vieirater/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.0/lib/nokogiri.rb:28:in `require': cannot load such file -- nokogiri/nokogiri (LoadError)
from /home/vieirater/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.0/lib/nokogiri.rb:28:in `<top (required)>'
from /home/vieirater/.rvm/gems/ruby-2.0.0-p247/gems/rack-pjax-0.7.0/lib/rack/pjax.rb:1:in `require'
from /home/vieirater/.rvm/gems/ruby-2.0.0-p247/gems/rack-pjax-0.7.0/lib/rack/pjax.rb:1:in `<top (required)>'
from /home/vieirater/.rvm/gems/ruby-2.0.0-p247/gems/rack-pjax-0.7.0/lib/rack-pjax.rb:2:in `require'
from /home/vieirater/.rvm/gems/ruby-2.0.0-p247/gems/rack-pjax-0.7.0/lib/rack-pjax.rb:2:in `<top (required)>'
from /home/vieirater/.rvm/gems/ruby-2.0.0-p247/gems/rails_admin-0.5.0/lib/rails_admin/engine.rb:7:in `require'
from /home/vieirater/.rvm/gems/ruby-2.0.0-p247/gems/rails_admin-0.5.0/lib/rails_admin/engine.rb:7:in `<top (required)>'
from /home/vieirater/.rvm/gems/ruby-2.0.0-p247/gems/rails_admin-0.5.0/lib/rails_admin.rb:1:in `require'
from /home/vieirater/.rvm/gems/ruby-2.0.0-p247/gems/rails_admin-0.5.0/lib/rails_admin.rb:1:in `<top (required)>'
from /home/vieirater/.rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /home/vieirater/.rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /home/vieirater/.rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /home/vieirater/.rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /home/vieirater/.rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /home/vieirater/.rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /home/vieirater/.rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /home/vieirater/website/config/application.rb:7:in `<top (required)>'
from /home/vieirater/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:44:in `require'
from /home/vieirater/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:44:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
You can try to run
rvm ruby-2.0.0-p247 gem update --system
More detail in this blog post on the very same issue.
recently I have updated to rails 4.0.0.rc1 and I have been experiencing a few errors. I am currently using RVM as well. After creating a rails 4 app and running 'rails s' or 'rspec rails' i got the error -
/Users/metaHunts/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-1.7.7/lib/json/common.rb:67:in `initialize': no implicit conversion of nil into Hash (TypeError)
from /Users/metaHunts/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-1.7.7/lib/json/common.rb:67:in `new'
from /Users/metaHunts/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-1.7.7/lib/json/common.rb:67:in `generator='
from /Users/metaHunts/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-1.7.7/lib/json/ext.rb:17:in `<module:Ext>'
from /Users/metaHunts/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-1.7.7/lib/json/ext.rb:12:in `<module:JSON>'
from /Users/metaHunts/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-1.7.7/lib/json/ext.rb:9:in `<top (required)>'
from /Users/metaHunts/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-1.7.7/lib/json.rb:58:in `require'
from /Users/metaHunts/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-1.7.7/lib/json.rb:58:in `<module:JSON>'
from /Users/metaHunts/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-1.7.7/lib/json.rb:54:in `<top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc1/lib/active_support/core_ext/object/to_json.rb:3:in `require'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc1/lib/active_support/core_ext/object/to_json.rb:3:in `<top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc1/lib/active_support/core_ext/object.rb:11:in `require'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc1/lib/active_support/core_ext/object.rb:11:in `<top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/configuration.rb:3:in `require'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/configuration.rb:3:in `<top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/railtie.rb:2:in `require'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/railtie.rb:2:in `<top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/engine.rb:1:in `require'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/engine.rb:1:in `<top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/application.rb:4:in `require'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/application.rb:4:in `<top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails.rb:9:in `require'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails.rb:9:in `<top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.0.rc1/lib/active_record/railtie.rb:2:in `require'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.0.rc1/lib/active_record/railtie.rb:2:in `<top (required)>'
from /Users/metaHunts/Desktop/TeenStarter/config/application.rb:4:in `require'
from /Users/metaHunts/Desktop/TeenStarter/config/application.rb:4:in `<top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:78:in `require'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:78:in `block in <top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:75:in `tap'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:75:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I have tried reloading rvm, cleaing and repairing it as well yet I keep getting the same error. Could I please have some help in fixing it.
Thanks in advance :)
Had the same problem. For some reason I don't know it got fixed by running:
gem install json -v 1.7.7
Solved by removing RVM with
rvm implode
before reinstalling it with the command on rvm website (https://rvm.io/).