Undefined `environment 'method for nil: NilClass when importing Bootstrap

I am trying to import Bootstrap into my rails application, and I'm not quite sure what is going wrong. I worked on this before, but I did a β€œpackage update” and destroyed some dependencies (I think). I seem to have fixed everything ... except Bootstrap.

I tried to remove and re-enter the gems "bootstrap-sass" ... I can not figure out where the error is.

Thanks for the help!

Gemfile

source 'https://rubygems.org' ruby '2.0.0' gem 'rails', '4.0.1' gem 'bootstrap-sass' gem 'bcrypt-ruby', '3.1.2' gem 'faker', '1.1.2' group :development, :test do gem 'sqlite3', '1.3.8' gem 'rspec-rails' end group :test do gem 'selenium-webdriver', '2.35.1' gem 'capybara', '2.1.0' gem 'factory_girl_rails', '4.2.1' gem 'database_cleaner', github: 'bmabey/database_cleaner' end gem 'sass-rails' gem 'uglifier', '2.1.1' gem 'coffee-rails', '4.0.1' gem 'jquery-rails', '3.0.4' gem 'turbolinks', '1.1.1' gem 'jbuilder', '1.0.2' group :doc do gem 'sdoc', '0.3.20', require: false end group :production do gem 'pg', '0.15.1' gem 'rails_12factor', '0.0.2' end 

Gemfile.lock

 GIT remote: git://github.com/bmabey/database_cleaner.git revision: 35bd646903fc56af185a9fa9e360c568bb56756e specs: database_cleaner (1.2.0) GEM remote: https://rubygems.org/ specs: actionmailer (4.0.1) actionpack (= 4.0.1) mail (~> 2.5.4) actionpack (4.0.1) activesupport (= 4.0.1) builder (~> 3.1.0) erubis (~> 2.7.0) rack (~> 1.5.2) rack-test (~> 0.6.2) activemodel (4.0.1) activesupport (= 4.0.1) builder (~> 3.1.0) activerecord (4.0.1) activemodel (= 4.0.1) activerecord-deprecated_finders (~> 1.0.2) activesupport (= 4.0.1) arel (~> 4.0.0) activerecord-deprecated_finders (1.0.3) activesupport (4.0.1) i18n (~> 0.6, >= 0.6.4) minitest (~> 4.2) multi_json (~> 1.3) thread_safe (~> 0.1) tzinfo (~> 0.3.37) arel (4.0.2) atomic (1.1.15) bcrypt-ruby (3.1.2) bootstrap-sass (3.1.1.0) sass (~> 3.2) builder (3.1.4) capybara (2.1.0) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) childprocess (0.5.1) ffi (~> 1.0, >= 1.0.11) coffee-rails (4.0.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) coffee-script (2.2.0) coffee-script-source execjs coffee-script-source (1.7.0) diff-lcs (1.2.5) erubis (2.7.0) execjs (2.0.2) factory_girl (4.2.0) activesupport (>= 3.0.0) factory_girl_rails (4.2.1) factory_girl (~> 4.2.0) railties (>= 3.0.0) faker (1.1.2) i18n (~> 0.5) ffi (1.9.3) hike (1.2.3) i18n (0.6.9) jbuilder (1.0.2) activesupport (>= 3.0.0) jquery-rails (3.0.4) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.8.1) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) mini_portile (0.5.2) minitest (4.7.5) multi_json (1.9.0) nokogiri (1.6.1) mini_portile (~> 0.5.0) pg (0.15.1) polyglot (0.3.4) rack (1.5.2) rack-test (0.6.2) rack (>= 1.0) rails (4.0.1) actionmailer (= 4.0.1) actionpack (= 4.0.1) activerecord (= 4.0.1) activesupport (= 4.0.1) bundler (>= 1.3.0, < 2.0) railties (= 4.0.1) sprockets-rails (~> 2.0.0) rails_12factor (0.0.2) rails_serve_static_assets rails_stdout_logging rails_serve_static_assets (0.0.2) rails_stdout_logging (0.0.3) railties (4.0.1) actionpack (= 4.0.1) activesupport (= 4.0.1) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.1.1) rdoc (3.12.2) json (~> 1.4) rspec-core (2.14.8) rspec-expectations (2.14.5) diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.14.6) rspec-rails (2.14.1) actionpack (>= 3.0) activemodel (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) rspec-core (~> 2.14.0) rspec-expectations (~> 2.14.0) rspec-mocks (~> 2.14.0) rubyzip (0.9.9) sass (3.3.2) sass-rails (4.0.1) railties (>= 4.0.0, < 5.0) sass (>= 3.1.10) sprockets-rails (~> 2.0.0) sdoc (0.3.20) json (>= 1.1.3) rdoc (~> 3.10) selenium-webdriver (2.35.1) childprocess (>= 0.2.5) multi_json (~> 1.0) rubyzip (< 1.0.0) websocket (~> 1.0.4) sprockets (2.12.0) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) sprockets-rails (2.0.1) actionpack (>= 3.0) activesupport (>= 3.0) sprockets (~> 2.8) sqlite3 (1.3.8) thor (0.18.1) thread_safe (0.2.0) atomic (>= 1.1.7, < 2) tilt (1.4.1) treetop (1.4.15) polyglot polyglot (>= 0.3.1) turbolinks (1.1.1) coffee-rails tzinfo (0.3.39) uglifier (2.1.1) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) websocket (1.0.7) xpath (2.0.0) nokogiri (~> 1.3) PLATFORMS ruby DEPENDENCIES bcrypt-ruby (= 3.1.2) bootstrap-sass capybara (= 2.1.0) coffee-rails (= 4.0.1) database_cleaner! factory_girl_rails (= 4.2.1) faker (= 1.1.2) jbuilder (= 1.0.2) jquery-rails (= 3.0.4) pg (= 0.15.1) rails (= 4.0.1) rails_12factor (= 0.0.2) rspec-rails sass-rails sdoc (= 0.3.20) selenium-webdriver (= 2.35.1) sqlite3 (= 1.3.8) turbolinks (= 1.1.1) uglifier (= 2.1.1) 
+46
ruby-on-rails twitter-bootstrap
Mar 13 '14 at 23:04
source share
5 answers

I also ran into this problem, and it looks like a problem with the latest version of asterisks, and you can fix it as suggested by modifying Gemfile.lock, but if someone or something updates the package, it will break again , and I know that some places do not like to check in Gemfile.lock until they click on the scene.

If you use sass-rails better than 4.0.0, this will solve the problem ...

 gem 'sass-rails', '~> 4.0.0' 

The problem is solved, and it will be limited to asterisks to 2.11. From the generated Gemfile.lock ...

  sass-rails (4.0.2) railties (>= 4.0.0, < 5.0) sass (~> 3.2.0) sprockets (~> 2.8, <= 2.11.0) sprockets-rails (~> 2.0.0) 
+61
Mar 14 '14 at 2:50
source share
β€” -

Today I ran into this exact problem and was able to solve it.

It's funny that everything was fine yesterday (I have evidence, because yesterday I sent the working version to Heroka before going to bed), but today everything went after I did bundle update . Thus, I looked at the terminal output and noticed that the gem of stars was updated to 2.12.0. Then I came back and realized that it was 2.11.0 yesterday. Hm ...

While waiting, I edited my gemfile and added this line:

 gem 'sprockets', '2.11.0' 

Basically, to get bundler to install this particular version. Then I did another bundle update and voila! Things started working again.

+34
Mar 14 '14 at 1:40
source share

I upgraded my project to rails 4.0.4 yesterday and was getting the same error. Performing a package update did not help me. Removing and reinstalling sass-rails only installed version 4.0.1. I had to change my gemfile:

 gem 'sass-rails' 

at

 gem 'sass-rails', '~> 4.0.2' 

Then, after running 'bundle update', rspec now works as it should.

+27
Mar 23 '14 at 22:30
source share

It was a conflict of the version with precious stones.

Please, use

gem 'sass-rails', '~> 4.0.0'

instead

gem 'sass-rails'

Run bundle update right after that. That should fix it.

+7
Mar 14 '14 at 1:07
source share

I just ran into this problem after updating sass to 3.3.3 and sprockets to 2.12.0.

I ran $ bundle outdated to check which gems are out of date, and indeed sass-rails was turned on:

 * sass-rails (4.0.2 > 4.0.1) 

Using $ bundle update sass-rails solved this for me.

If you use $ bundle update instead, this will also solve the problem, but also update other gems that are not version related. Updating your gems one at a time is more time consuming, but more useful for diagnosing a conflict of gems.

+7
Mar 15
source share



All Articles