0
rake aborted!
undefined method 'environment' for nil:NilClass
(in /tmp/build_ae55b983-43e6-4074-8c54-6f05382a3ec4/app/assets/stylesheets/custom.css.scss)
/tmp/build_ae55b983-43e6-4074-8c54-6f05382a3ec4/vendor/bundle/ruby/1.9.1/gems/sass-rails-4.0.1/lib/sass/rails/importer.rb:84:in 'evaluate'
and so forth...

I'm posting my custom.css.scss file, in case the problem is there, but it matches the code posted in the tutorial, so I don't think that's the issue. This is chapter 9 of Michael Hertl's Ruby on Rails Tutorial, and this is the first problem I've encountered while trying to push to heroku. The app works locally, but won't push to Heroku. I tried changing the sprockets gem to 2.11.0 as recommended by another post, but it did not fix the problem.

custom.css.scss:

@import "bootstrap";

/* mixins, variables, etc. */

$grayMediumLight: #eaeaea;

@mixin box_sizing {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  }

/* universal */

html {
  overflow-y: scroll;
  }

body {
  padding-top: 60px;
  }

section{
  overflow: auto;
  }

textarea {
  resize: vertical;
  }

.center {
  text-align: center;
  h1 {
    margin-bottom: 10px;
    }
  }

/* typography */

h1, h2, h3, h4, h5, h6 {
  line-height: 1;
  }

h1 {
  font-size: 3em;
  letter-spacing: -2px;
  margin-bottom: 30px;
  text-align: center;
  }

h2 {
  font-size: 1.2em;
  letter-spacing: -1px;
  margin-bottom: 30px;
  text-align: center;
  font-weight: normal;
  color: $grayLight;
  }

p { 
  font-size: 1.1em;
  line-height: 1.7em;
  }

/* header */

#logo {
  float: left;
  margin-right: 10px;
  font-size: 1.7em;
  color: white;
  text-transform: uppercase;
  letter-spacing: -1px;
  padding-top: 9px;
  font-weight: bold;
  line-height: 1;
  &:hover {
    color: white;
    text-decoration: none;
    }
  }

/* footer */

footer {
  margin-top: 45px;
  padding-top: 5px;
  border-top: 1px solid $grayMediumLight;
  color: $grayLight;
  a {
    color: $gray;
    &:hover {
      color: $grayDarker;
    } 
  }
  small {
    float: left;
    }
  ul {
    float: right;
    list-style: none;
    li {
      float: left;
      margin-left: 10px;
      }
    }
  }

/* sidebar */

aside {
  section {
    padding: 10px 0;
    border-top: 1px solid $grayLighter;
    &:first-child {
      border: 0;
      padding-top: 0;
      }
    span {
      display: block;
      margin-bottom: 3px;
      line-height: 1;
      }
    h1 {
      font-size: 1.4em;
      text-align: left;
      letter-spacing: -1px;
      margin-bottom: 3px;
      margin-top: 0px;
      }
    }
  }

.gravatar {
  float: left;
  margin-right: 10px;
  }

/* miscellaneous */

.debug_dump {
  clear: both;
  float: left;
  width: 100%;
  margin-top: 45px;
  @include box_sizing;
  } 

/* forms */

input, textarea, select, .uneditable-input {
  border: 1px solid #bbb;
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  @include box_sizing;
  }

input {
  height: auto !important;
  }

#error_explanation {
  color: #f00;
  ul {
    list-style: none;
    margin: 0 0 18px 0;
    }
  }

.field_with_errors {
  @extend .control-group;
  @extend .error;
  }

/* Users index */

.users {
  list-style: none;
  margin: 0;
  li {
    overflow: auto;
    padding: 10px 0;
    border-top: 1px solid $grayLighter;
    &:last-child {
      border-bottom: 1px solid $grayLighter;
    }
  }
}

Gemfile:

source 'https://rubygems.org'
ruby '1.9.3'
#ruby-gemset=railstutorial_rails_4_0

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.3'
gem 'bootstrap-sass', '2.3.2.0'
gem 'sprockets', '2.11.0'
gem 'bcrypt-ruby', '3.1.2'
gem 'faker', '1.1.2'
gem 'will_paginate', '3.0.4'
gem 'bootstrap-will_paginate', '0.0.9'

# Use sqlite3 as the database for Active Record
group :development, :test do
  gem 'sqlite3', '1.3.8'
  gem 'rspec-rails', '2.13.1'
end

group :test do
  gem 'selenium-webdriver', '2.35.1'
  gem 'capybara', '2.1.0'
  gem 'factory_girl_rails', '4.2.0'
  gem 'cucumber-rails', '1.4.0', :require => false
  gem 'database_cleaner', github: 'bmabey/database_cleaner'
end

# Use SCSS for stylesheets
gem 'sass-rails', '4.0.1'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '2.1.1'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '4.0.1'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails', '3.0.4'

# Turbolinks makes following links in your web application faster. Read more: #https://github.com/rails/turbolinks
gem 'turbolinks', '1.1.1'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '1.0.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', '0.3.20', require: false
end

group :production do
  gem 'pg', '0.15.1'
  gem 'rails_12factor', '0.0.2'
end

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'

# Use unicorn as the app server
# gem 'unicorn'

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

# Use debugger
# gem 'debugger', group: [:development, :test]e here
sites
  • 21,417
  • 17
  • 87
  • 146
CMurph
  • 1
  • 1

1 Answers1

0

I had this problem earlier on in the week with zurb-foundation on old rails apps that I was updating and also a new test app. After much messing about with gem versions I used rvm to create a new gemset and re ran bundler. All was well after that.

Jon Bramble
  • 326
  • 3
  • 6
  • I edited the gemfile to use sprockets 2.11.0 as suggested on another post, but that didn't help. Then I edited the custom.css.scss file. For some reason that I don't understand this fixed the problem. I'm glad it's working, but frustrated because I don't know what was wrong. – CMurph Mar 17 '14 at 01:50
  • I know it is frustrating not to know. I prefer getting stuff done in the little time I have so went with the gemset option. I was updating foundation to the new gem and was sure it was that, but as others have found out it was sprockets. Maybe it didn't compile your css file until you edited it. – Jon Bramble Mar 17 '14 at 16:58