Rails资产预编译给我一个SASS错误

时间:2018-10-09 17:41:56

标签: css ruby-on-rails sass asset-pipeline

尝试预编译资产时出现错误,特别是当它解析我得到的sass文件时:

  

Sass :: SyntaxError:列表索引为7,但列表仅6个项目   `nth'

这是我正在运行的命令:

$ rake assets:precompile
yarn install v1.10.1
[1/4]   Resolving packages...
[2/4]   Fetching packages...
[3/4]   Linking dependencies...
warning "@rails/webpacker > postcss-cssnext@3.1.0" has unmet peer dependency "caniuse-lite@^1.0.30000697".
warning " > webpack-dev-server@2.11.2" has unmet peer dependency "webpack@^2.2.0 || ^3.0.0".
warning "webpack-dev-server > webpack-dev-middleware@1.12.2" has unmet peer dependency "webpack@^1.0.0 || ^2.0.0 || ^3.0.0".
[4/4]   Building fresh packages...
success Saved lockfile.
✨  Done in 11.76s.
rake aborted!
Sass::SyntaxError: List index is 7 but list is only 6 items long for `nth'
/Users/blank/git/app123/web/node_modules/primer-support/lib/variables/layout.scss:31

在相同的错误中,它会显示以下内容:

  

原因:ArgumentError:列表索引为7,但列表仅6个项目   长   /Users/blank/.rvm/gems/ruby-2.5.1/gems/sass-3.5.7/lib/sass/script/value/list.rb:108:in   assert_valid_index' /Users/blank/.rvm/gems/ruby-2.5.1/gems/sass-3.5.7/lib/sass/script/functions.rb:2024:in nth'   /用户/空白/.rvm/gems/ruby-2.5.1/gems/sass-3.5.7/lib/sass/script/tree/funcall.rb:151:in   block in _perform' /Users/blank/.rvm/gems/ruby-2.5.1/gems/sass-3.5.7/lib/sass/stack.rb:108:in 使用with_function阻止

相关行如下:

// Aliases for easy use
$spacer-0: nth($spacers, 1) !default; // 0
$spacer-1: nth($spacers, 2) !default; // 4px
$spacer-2: nth($spacers, 3) !default; // 8px
$spacer-3: nth($spacers, 4) !default; // 16px
$spacer-4: nth($spacers, 5) !default; // 24px
$spacer-5: nth($spacers, 6) !default; // 32px
$spacer-6: nth($spacers, 7) !default; // 40px

https://github.com/primer/primer/blob/master/modules/primer-support/lib/variables/layout.scss#L31

明智的做法有什么问题?

0 个答案:

没有答案