哪个 gem 正在破坏 Rails application.css.scss 错误数量的参数 3 为 2 [英] Which gem is breaking Rails application.css.scss wrong number of arguments 3 for 2

查看:33
本文介绍了哪个 gem 正在破坏 Rails application.css.scss 错误数量的参数 3 为 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的.这是gem更新引起的新问题.调用 bundle update 会破坏我的 rails 应用程序.以下是改变的宝石:

Okay. This is a new problem caused by a gem update. Calling bundle update breaks my rails application. Here are the gems that changed:

# Gemfile.lock
-    compass (0.12.7)
+    compass (0.12.2)
-      sass (~> 3.2.19)
+      sass (~> 3.1)
-    country_select (2.0.1) # Not likely this
+    country_select (2.1.0) # Not likely this
-    devise (3.3.0)
+    devise (3.4.0)
+      responders
-    excon (0.39.6)
-    execjs (2.2.1)
+    excon (0.40.0)
+    execjs (2.2.2)
-    jbuilder (2.1.3)
+    jbuilder (2.2.2)
-    jquery-ui-rails (5.0.0)
+    jquery-ui-rails (5.0.1)
-    mime-types (2.3)
+    mime-types (2.4.2)
-    netrc (0.7.7)
+    netrc (0.8.0)
-    omniauth-twitter (1.0.1) # Not likely this
+    omniauth-twitter (1.1.0) # Not likely this
-    railroady (1.1.2)  # Not likely this
+    railroady (1.2.0) # Not likely this
-    rails_12factor (0.0.2)
+    rails_12factor (0.0.3)
-    rails_layout (1.0.22)
+    rails_layout (1.0.23)
-    sass (3.2.19)
+    sass (3.2.0)
-    sprockets-rails (2.1.4)
+    sprockets-rails (2.2.0)
-      sprockets (~> 2.8)
+      sprockets (>= 2.8, < 4.0)
-    turbolinks (2.3.0)
+    turbolinks (2.4.0)
-    twilio-ruby (3.13.0) # Not likely this
+    twilio-ruby (3.13.1) # Not likely this

我得到的错误是:

wrong number of arguments (3 for 2)
(in /app/assets/stylesheets/application.css.scss)

更好的错误表明它发生在这一行:

And better errors shows it happening at this line:

<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>

如果你能告诉我是哪个 gem 导致了这个错误,我可以在我的 Gemfile 中版本化新的 gem.它在我的本地机器和 Heroku 上做同样的事情.我现在正在维护旧的 Gemfile.lock.

If you can tell me which gem is responsible for the error I can version out the new one in my Gemfile. It does the same thing on my local machine and Heroku. I'm maintaining the older Gemfile.lock for now.

为了记录,我尝试单独安装每个 gem.之后我在本地机器上没有问题,但 Heroku 失败并出现同样的错误并且无法构建.

For the record I tried installing each gem individually. Afterwards I had no problem on the local machine, but Heroku failed with the same error and would not build.

按照 Paul Richter 的建议,要么是指南针、链轮,要么是 sass

Following Paul Richter's tip it's either compass, sprockets, or sass

sass-rails (4.0.3) lib/sass/rails/importer.rb:80:in `engine_from_path'
sass-rails (4.0.3) lib/sass/rails/importer.rb:27:in `find_relative'
sass (3.2.0) lib/sass/tree/import_node.rb:45:in `import'
sass (3.2.0) lib/sass/tree/import_node.rb:25:in `imported_file'
sass (3.2.0) lib/sass/tree/import_node.rb:34:in `css_import?'
sass (3.2.0) lib/sass/tree/visitors/perform.rb:214:in `visit_import'
sass (3.2.0) lib/sass/tree/visitors/base.rb:37:in `visit'
sass (3.2.0) lib/sass/tree/visitors/perform.rb:97:in `visit'
sass (3.2.0) lib/sass/tree/visitors/base.rb:53:in `block in visit_children'
sass (3.2.0) lib/sass/tree/visitors/base.rb:53:in `visit_children'
sass (3.2.0) lib/sass/tree/visitors/perform.rb:106:in `block in visit_children'
sass (3.2.0) lib/sass/tree/visitors/perform.rb:118:in `with_environment'
sass (3.2.0) lib/sass/tree/visitors/perform.rb:105:in `visit_children'
sass (3.2.0) lib/sass/tree/visitors/base.rb:37:in `block in visit'
sass (3.2.0) lib/sass/tree/visitors/perform.rb:125:in `visit_root'
sass (3.2.0) lib/sass/tree/visitors/base.rb:37:in `visit'
sass (3.2.0) lib/sass/tree/visitors/perform.rb:97:in `visit'
sass (3.2.0) lib/sass/tree/visitors/perform.rb:7:in `visit'
sass (3.2.0) lib/sass/tree/root_node.rb:20:in `render'
sass (3.2.0) lib/sass/engine.rb:315:in `_render'
sass (3.2.0) lib/sass/engine.rb:262:in `render'
compass-rails (2.0.0) lib/compass-rails/patches/sass_importer.rb:29:in `evaluate'
tilt (1.4.1) lib/tilt/template.rb:103:in `render'
sprockets (2.11.0) lib/sprockets/context.rb:197:in `block in evaluate'
sprockets (2.11.0) lib/sprockets/context.rb:194:in `evaluate'
sprockets (2.11.0) lib/sprockets/processed_asset.rb:12:in `initialize'
sprockets (2.11.0) lib/sprockets/base.rb:374:in `block in build_asset'
sprockets (2.11.0) lib/sprockets/base.rb:395:in `circular_call_protection'
sprockets (2.11.0) lib/sprockets/base.rb:373:in `build_asset'
sprockets (2.11.0) lib/sprockets/index.rb:94:in `block in build_asset'
sprockets (2.11.0) lib/sprockets/caching.rb:58:in `cache_asset'
sprockets (2.11.0) lib/sprockets/index.rb:93:in `build_asset'
sprockets (2.11.0) lib/sprockets/base.rb:287:in `find_asset'
sprockets (2.11.0) lib/sprockets/index.rb:61:in `find_asset'
sprockets (2.11.0) lib/sprockets/bundled_asset.rb:16:in `initialize'
sprockets (2.11.0) lib/sprockets/base.rb:377:in `build_asset'
sprockets (2.11.0) lib/sprockets/index.rb:94:in `block in build_asset'
sprockets (2.11.0) lib/sprockets/caching.rb:58:in `cache_asset'
sprockets (2.11.0) lib/sprockets/index.rb:93:in `build_asset'
sprockets (2.11.0) lib/sprockets/base.rb:287:in `find_asset'
sprockets (2.11.0) lib/sprockets/index.rb:61:in `find_asset'
sprockets (2.11.0) lib/sprockets/environment.rb:75:in `find_asset'
sprockets (2.11.0) lib/sprockets/base.rb:295:in `[]'
sprockets-rails (2.2.0) lib/sprockets/rails/helper.rb:230:in `lookup_asset_for_path'
sprockets-rails (2.2.0) lib/sprockets/rails/helper.rb:190:in `check_errors_for'
sprockets-rails (2.2.0) lib/sprockets/rails/helper.rb:159:in `block in stylesheet_link_tag'
sprockets-rails (2.2.0) lib/sprockets/rails/helper.rb:158:in `stylesheet_link_tag'

推荐答案

我发现更新的 gems 在他们的说明中有将 application.css 更改为 application.css.scss,不要将 'application' 识别为 stylesheet_link_tagscss 文件的参数.你需要改变:

I've found that the updated gems, which have in their instructions to change application.css to application.css.scss, don't recognize just 'application' as a parameter for a scss file for stylesheet_link_tag. You need to change:

<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>

为此:

<%= stylesheet_link_tag 'application.css.scss', media: 'all', 'data-turbolinks-track' => true %>

这将允许您使用最新的 gem.

This will allow you to work with the latest gems.

这篇关于哪个 gem 正在破坏 Rails application.css.scss 错误数量的参数 3 为 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆