新手问题 使用 high_voltage 后,显示首页出现这个错误,没有思路,求指点。

fengfans · 2016年10月03日 · 最后由 kayakjiang 回复于 2016年10月03日 · 2200 次阅读

路由中定义如下:

root :to => 'high_voltage/pages#show', :id => 'welcome'

打开首页则报错如下:

NoMethodError at /
undefined method `environment' for nil:NilClass
  (in /home/f/RailsPrjects/groupme/app/assets/stylesheets/common.css.scss)

定位错误代码为 app/views/layouts/application.html.erb 文件中的:

<%= stylesheet_link_tag "application" %>

输出的变量信息如下:

Request info

Request parameters  
{"id"=>"welcome", "controller"=>"high_voltage/pages", "action"=>"show"}


Local Variables

local_assigns   {}
output_buffer   nil
_old_virtual_path   nil
_old_output_buffer  nil
Instance Variables
@_routes    nil
@_config    {}

我修改了 gem 'sass-rails', '~> 4.0.0.rc1' 为 gem 'sass-rails', '~> 4.0.0', 重新 bundle install,rails s。 刷 新页面还是这个问题。有哪里不对吗?

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'

# Use mysql as the database for Active Record
#gem 'mysql2'
gem 'sqlite3'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
gem 'sass', '>=3.3.13'

# 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'
gem 'devise', '3.5.10'
gem "seo_helper", "~> 1.0"
gem "open_graph_helper"

gem "rmagick"
gem "carrierwave"
gem "carrierwave-meta"

gem "settingslogic"

gem "anjlab-bootstrap-rails", ">= 2.2.2", :require => "bootstrap-rails"
gem "bootstrap_helper", ">= 4.2.2.1"
gem "simple_form", "~> 3.0.0.beta1"
gem "will_paginate", "3.0.3"

gem "high_voltage"

gem "airbrake"

gem "rvm-capistrano"

gem "omniauth"
gem "omniauth-facebook"
gem "auto-facebook", '0.4'


gem "hipchat"

# Cache
gem "dalli"

group :assets do
  gem "compass-rails", '3.0.2'
end

group :development do
  gem "capistrano"
  gem "capistrano-ext"
  gem "cape"
  gem "binding_of_caller"
  gem "better_errors"
  gem "magic_encoding"
  gem "annotate"
  gem "powder"
  gem "pry-nav"
  gem "pry-remote"
end



# 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', '~> 1.0.1'

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

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

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

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

# Use debugger
# gem 'debugger', group: [:development, :test]

/home/f/RailsPrjects/groupme/app/assets/stylesheets/common.css.scss 这个文件里面是什么内容?

需要 登录 后方可回复, 如果你还没有账号请 注册新账号