运行Rails服务器时出错 - 无法加载gem'sass-rails'

时间:2017-05-20 06:43:37

标签: ruby-on-rails ruby ruby-on-rails-4 ruby-on-rails-5 ruby-2.3

我是Rails的新手并且第一次尝试加载和配置它。我按照http://installrails.com/steps/rails_for_linux_and_other上的说明在Linux上安装(我实际上使用的是安装在Windows 10主机上的Ubuntu虚拟机)。

我一直收到这个错误:

`rescue in block (2 levels) in require': There was an error while trying to load the gem 'sass-rails'. (Bundler::GemRequireError)
Gem Load Error is: uninitialized constant Sass::Rails::Tilt

似乎没有任何东西可以告诉我该怎么做。我实际上已经卸载了,并且重新安装了Rails一次,因为我认为我的Rails版本存在问题(我确实有 Rails 5.1.1 ),但是同样的事情现在正在发生(与 Rails 4.2.6 )。

Ruby版本:

ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]

宝石清单:

*** LOCAL GEMS ***

actioncable (5.1.1)
actionmailer (5.1.1, 4.2.6)
actionpack (5.1.1, 4.2.6)
actionview (5.1.1, 4.2.6)
activejob (5.1.1, 4.2.6)
activemodel (5.1.1, 4.2.6)
activerecord (5.1.1, 4.2.6)
activesupport (5.1.1, 4.2.6)
addressable (2.5.1)
arel (8.0.0, 6.0.4)
bigdecimal (1.2.8)
bindex (0.5.0)
binding_of_caller (0.7.2)
builder (3.2.3)
bundler (1.14.6)
bundler-unload (1.0.2)
byebug (9.0.6)
capybara (2.14.0)
childprocess (0.7.0)
coffee-rails (4.2.1, 4.1.1)
coffee-script (2.4.1)
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
debug_inspector (0.0.3)
did_you_mean (1.0.0)
erubi (1.6.0)
erubis (2.7.0)
execjs (2.7.0)
executable-hooks (1.3.2)
ffi (1.9.18)
gem-wrappers (1.2.7)
globalid (0.4.0)
i18n (0.8.1)
io-console (0.4.5)
jbuilder (2.6.4)
jquery-rails (4.3.1)
json (1.8.6, 1.8.3)
listen (3.1.5)
loofah (2.0.3)
mail (2.6.5)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.10.2, 5.8.5)
multi_json (1.12.1)
mustermann (1.0.0)
net-telnet (0.1.1)
nio4r (2.0.0)
nokogiri (1.7.2)
power_assert (0.2.6)
psych (2.1.0)
public_suffix (2.0.5)
puma (3.8.2)
rack (2.0.3, 1.6.8)
rack-protection (2.0.0)
rack-test (0.6.3)
rails (4.2.6)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (2.0.3, 1.0.8)
rails-html-sanitizer (1.0.3)
railties (4.2.6)
rake (12.0.0, 10.4.2)
rb-fsevent (0.9.8)
rb-inotify (0.9.8)
rdoc (4.3.0, 4.2.1)
ruby_dep (1.5.0)
rubygems-bundler (1.4.4)
rubyzip (1.2.1)
rvm (1.11.3.9)
sass (3.4.24)
sass-rails (5.0.6)
sdoc (0.4.2)
selenium-webdriver (3.4.0)
sinatra (2.0.0)
spring (2.0.1)
spring-watcher-listen (2.0.1)
sprockets (3.7.1)
sprockets-rails (3.2.0)
sqlite3 (1.3.13)
test-unit (3.1.5)
thor (0.19.4)
thread_safe (0.3.6)
tilt (2.0.7)
turbolinks (5.0.1)
turbolinks-source (5.0.3)
tzinfo (1.2.3)
uglifier (3.2.0)
web-console (3.5.1, 2.3.0)
websocket (1.2.4)
websocket-driver (0.6.5)
websocket-extensions (0.1.2)
xpath (2.0.0)

感谢您的帮助。

2 个答案:

答案 0 :(得分:0)

尝试运行以下命令:

bundle update

如果失败,请尝试在下面的代码中发表评论:

saas-rails

bundle install

答案 1 :(得分:0)

我评论了

gem 'sass-rails'

然后做了

bundle update

服务器现在似乎正常工作。我唯一不确定的是,如果我需要那些宝石。 (就像我说的,我是Rails的新手)。