0

I am having trouble getting rails to run on my mac. This is the output that I get. It seems to be a problem with my packages or the Ruby or rvm version, but I don't know how to resolve it. I end up having to deploy to Heroku every time to test something.

Pauls-MacBook-Pro:heroku paulyang$ rails console
/Users/paulyang/.rvm/gems/ruby-2.3.3/gems/spring-2.0.1/lib/spring/application.rb:108:in `ensure in preload': undefined method `application' for Rails:Module (NoMethodError)
    from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/spring-2.0.1/lib/spring/application.rb:112:in `preload'
    from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/spring-2.0.1/lib/spring/application.rb:143:in `serve'
    from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/spring-2.0.1/lib/spring/application.rb:131:in `block in run'
    from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/spring-2.0.1/lib/spring/application.rb:125:in `loop'
    from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/spring-2.0.1/lib/spring/application.rb:125:in `run'
    from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/spring-2.0.1/lib/spring/application/boot.rb:19:in `<top (required)>'
    from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from -e:1:in `<main>'

This is the gemfile I'm using for my Rails app:

source 'https://rubygems.org'
ruby '2.3.3'

gem 'sinatra'
# sinatra needs old tilt version: http://stackoverflow.com/questions/20648394/moduletemplates-uninitialized-constant-tiltcompilesite-nameerror-using
#https://groups.google.com/forum/#!topic/sinatrarb/mAtn7AZBVmY
gem 'tilt', '~> 1.4.1', group: :production
gem 'rest-client'
gem 'sequel'
gem 'sqlite3', group: :development
gem 'pg', '~> 0.18', group: :development
gem 'cowsay'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18', group: :production
gem 'rails_12factor', group: :production
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',  platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0',          group: :doc

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring',        group: :development

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

gem 'puma'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# for auto-renewable subscription validation
# https://github.com/gabrielgarza/monza/blob/master/README.md
gem 'monza'
gem 'itunes-receipt'

Any help would be great.

mjpablo23
  • 681
  • 1
  • 7
  • 23
  • What about `bundle exec rails console`? – Babar Al-Amin Aug 15 '17 at 04:57
  • Why don't you list the exact steps you took to install Rails on your Mac, as well as what you did just prior to running `rails console` (i.e. did you add any new gems). You might as well post your gemfile as well. I'm particularly interested in your version of Spring. – MarsAtomic Aug 15 '17 at 05:33
  • >> spring -v Spring version 2.0.1 – mjpablo23 Aug 15 '17 at 17:02
  • sorry, I'm not sure what steps I took to install rails since it was a long time ago. I will add the gemfile to the post – mjpablo23 Aug 15 '17 at 17:03
  • I bundle installed spring 2.0.2, but when I run rails console, it's still referring to spring-2.0.1. I remember that I had trouble getting the correct Ruby and rails versions set up because they refer to each other, and the references would get messed up. I had this setup working with heroku so I didn't want to mess with it. – mjpablo23 Aug 15 '17 at 18:06
  • @mjpablo23, take it one step at a time, ensure that your version of Ruby 2.3.3 works with your version of Rails 4.2.5. Next ensure you have a database running on your Mac. Your gems show both SQLite and postgreSQL. For me that would be confusing, I would eliminate the one I do not plan to use. Next ensure you can login to that database. – Daniel Sep 06 '17 at 19:15
  • I ended up getting it running, thanks. – mjpablo23 Sep 06 '17 at 20:09

0 Answers0