简体   繁体   English

Rails Server引发错误“无法加载此类文件” — sass / logger(LoadError)

[英]`rails server` throws error “cannot load such file” — sass/logger (LoadError)

Rails: 3.2.12 Ruby: 1.9.3p392 (openSuse package) OS: openSuse 12.3 Rails:3.2.12 Ruby:1.9.3p392(openSuse软件包)OS:openSuse 12.3

I just ran rails new specsheets . 我只是运行rails new specsheets This ran cleanly including the bundle install: 干净运行,包括捆绑安装:

<snip>
         run  bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.1) 
Using i18n (0.6.9) 
Using multi_json (1.8.4) 
Using activesupport (3.2.12) 
Using builder (3.0.4) 
Using activemodel (3.2.12) 
Using erubis (2.7.0) 
Using journey (1.0.4) 
Using rack (1.4.5) 
Using rack-cache (1.2) 
Using rack-test (0.6.2) 
Using hike (1.2.3) 
Using tilt (1.4.1) 
Using sprockets (2.2.2) 
Using actionpack (3.2.12) 
Using mime-types (1.25.1) 
Using polyglot (0.3.3) 
Using treetop (1.4.15) 
Using mail (2.4.4) 
Using actionmailer (3.2.12) 
Using arel (3.0.3) 
Using tzinfo (0.3.38) 
Using activerecord (3.2.12) 
Using activeresource (3.2.12) 
Using bundler (1.3.5) 
Using coffee-script-source (1.7.0) 
Using execjs (2.0.2) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.3) 
Using json (1.8.1) 
Using rdoc (3.12.2) 
Using thor (0.18.1) 
Using railties (3.2.12) 
Using coffee-rails (3.2.2) 
Using jquery-rails (3.1.0) 
Using rails (3.2.12) 
Using sass (3.2.14) 
Using sass-rails (3.2.6) 
Using sqlite3 (1.3.8) 
Using uglifier (2.4.0) 
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

When I attempt to start the WEBrick server it throws the following at me: 当我尝试启动WEBrick服务器时,它向我抛出以下内容:

/usr/lib/ruby/gems/1.9.1/gems/sass-rails-3.2.6/lib/sass/rails/logger.rb:1:in `require': cannot load such file -- sass/logger (LoadError)
    from /usr/lib/ruby/gems/1.9.1/gems/sass-rails-3.2.6/lib/sass/rails/logger.rb:1:in `<top (required)>'
    from /usr/lib/ruby/gems/1.9.1/gems/sass-rails-3.2.6/lib/sass/rails/railtie.rb:23:in `<class:Railtie>'
    from /usr/lib/ruby/gems/1.9.1/gems/sass-rails-3.2.6/lib/sass/rails/railtie.rb:4:in `<module:Rails>'
    from /usr/lib/ruby/gems/1.9.1/gems/sass-rails-3.2.6/lib/sass/rails/railtie.rb:3:in `<top (required)>'
    from /usr/lib/ruby/gems/1.9.1/gems/sass-rails-3.2.6/lib/sass/rails.rb:16:in `require'
    from /usr/lib/ruby/gems/1.9.1/gems/sass-rails-3.2.6/lib/sass/rails.rb:16:in `<top (required)>'
    from /usr/lib/ruby/gems/1.9.1/gems/sass-rails-3.2.6/lib/sass-rails.rb:1:in `require'
    from /usr/lib/ruby/gems/1.9.1/gems/sass-rails-3.2.6/lib/sass-rails.rb:1:in `<top (required)>'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /home/msnyder/bin/ruby/specsheets/config/application.rb:7:in `<top (required)>'
    from /usr/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:53:in `require'
    from /usr/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:53:in `block in <top (required)>'
    from /usr/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:50:in `tap'
    from /usr/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

I'm new to rails so I don't know what to look for. 我是Rails的新手,所以我不知道要寻找什么。 In the past I'd go to the directory in question (/usr/lib/ruby/gems/1.9.1/gems/) and make sure everything was readable by non-root users and groups. 过去,我会转到有问题的目录(/usr/lib/ruby/gems/1.9.1/gems/),并确保所有内容都可由非root用户和组读取。 This hasn't worked this time around. 这次没有奏效。

I also noticed that my Gemfile mentioned sass-rails 3.2.3 while the installed version is 3.2.6. 我还注意到,我的Gemfile提到了sass-rails 3.2.3,而安装的版本是3.2.6。 I modified the Gemfile to reflect this but still get the errors. 我修改了Gemfile以反映这一点,但仍然收到错误。

My Gemfile: 我的Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.12'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.6'
  gem 'coffee-rails', '~> 3.2.1'

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

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

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

# To use Jbuilder templates for JSON
# gem 'jbuilder'

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

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'

The log directory under the application directory is empty so there is nothing to report from there. 应用程序目录下的日志目录为空,因此没有要报告的内容。

The server starts fine when run with sudo . 使用sudo运行时,服务器启动正常。 However, as I have this in my own /home directory that shouldn't be the case. 但是,由于我在自己的/ home目录中有此问题,因此情况并非如此。

Put sass-rails above rails in your gemfile. 在您的gemfile中将sass-rails置于rails之上。

The sass-rails gem is trying to setup the logger and cannot find the Sass::Rails::Logger class. sass-rails gem正在尝试设置记录器,但找不到Sass::Rails::Logger类。 https://github.com/rails/sass-rails/blob/3-2-stable/lib/sass/rails/railtie.rb#L23 https://github.com/rails/sass-rails/blob/3-2-stable/lib/sass/rails/railtie.rb#L23

This is probably because you are calling sass before it has time to setup and autoload. 这可能是因为您在有时间设置和自动加载之前调用sass。 https://github.com/rails/sass-rails/blob/3-2-stable/lib/sass/rails.rb#L7 https://github.com/rails/sass-rails/blob/3-2-stable/lib/sass/rails.rb#L7

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 rails服务器抛出`require&#39;:无法加载这样的文件 - bigdecimal / util(LoadError) - rails server throws `require': cannot load such file — bigdecimal/util (LoadError) (Rails 5) LoadError: cannot load such file -- sass...当部署到 Heroku - (Rails 5) LoadError: cannot load such file -- sass ...when deploying to Heroku (Rails新手)rails服务器错误:无法加载此类文件 - bootsnap / setup(LoadError) - (New to Rails) rails server error: cannot load such file — bootsnap/setup (LoadError) 命令错误 - rails 服务器 - 无法加载此类文件 - sqlite3/sqlite3_native (LoadError) - Error for command - rails server - cannot load such file — sqlite3/sqlite3_native (LoadError) rails服务器上的错误 - 无法加载此类文件 - sqlite3 / sqlite3_native(LoadError) - error on rails server - cannot load such file — sqlite3/sqlite3_native (LoadError) Rails LoadError:无法加载此类文件-action_view / template / error - Rails LoadError: cannot load such file — action_view/template/error Ruby on Rails:错误“require”:无法加载此类文件——bundler/setup (LoadError) - Ruby on Rails: Error `require': cannot load such file -- bundler/setup (LoadError) Rails 无法加载此类文件 -- stringio (LoadError) - Rails cannot load such file -- stringio (LoadError) Rails:无法加载此类文件-byebug / byebug(LoadError) - Rails: cannot load such file — byebug/byebug (LoadError) 无法加载此类文件-Rails 4.2.6中的tml(LoadError) - cannot load such file — tml (LoadError) in Rails 4.2.6
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM