weixin_39744230
weixin_39744230
2020-11-28 18:02

node-sass error: expected a variable name (e.g. $x) or ')' for the parameter list for url

I'm getting this error when using this:

expected a variable name (e.g. $x) or ')' for the parameter list for url

This appears to be a bug in node-sass: https://github.com/sass/node-sass/issues/873

If you update your package.json to the latest version I suspect it will fix it.

该提问来源于开源项目:dlmanning/gulp-sass

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

5条回答

  • weixin_39747615 weixin_39747615 5月前

    Please provide a copy-pastable sample of code showing your issue. Without this we cannot help.

    点赞 评论 复制链接分享
  • weixin_39649736 weixin_39649736 5月前

    I am also seeing this error. I have attached some sample code for reference.

     sass
     image-sizes(
      $prefix: "img",
      $sizes: (
        small: (
          height: 23%,
          width: 265px
        ),
        medium: (
          height: 46%,
          width: 550px
        ),
        large: (
          height: 100%,
          width: none
        )
      );
      ) 
    {
       $size, $dimensions in $sizes {
         $prefix {
          $class: #{$prefix}-#{$size};
        }  {
          $class: $size;
        }
        &.#{$class} {
         width: nth($dimensions, 1);
         max-width: nth($dimensions, 2);
        }
      }
    
    }
    

    Output of libsass 3.4.1

    
    expected a variable name (e.g. $x) or ')' for the parameter list for image-sizes
    
    点赞 评论 复制链接分享
  • weixin_39747615 weixin_39747615 5月前

    please provide a fully working copy-pastable code snippet. How are you calling this mixin?

    点赞 评论 复制链接分享
  • weixin_39747615 weixin_39747615 5月前

    The linked node-sass patch has been released. I assume this is fixed but cannot confirm because a reproduction was not supplied.

    点赞 评论 复制链接分享
  • weixin_39525933 weixin_39525933 5月前

    Hello, I am getting this error too: events.js:154 throw er; // Unhandled 'error' event ^ Error: ..\Projects\SkyApp\scss\layouts_nav.scss Error: expected a variable name (e.g. $x) or ')' for the parameter list for add-border on line 6 of ../Projects/SkyApp/scss/layouts/_nav.scss

    
      add-border(1px; #e7e7e7, 'right-left');
    

    --------------------^

    
    at options.error (C:\xampp\htdocs\Gulp\node_modules\node-sass\lib\index.js:272:32)
    

    I am actually watching a tutorial from youtube: https://www.youtube.com/playlist?list=PLillGF-RfqbbpWowfjk9_Vv8XUuTBFPut

    I have a several folder with .scss files that are imported into the main.scss In the _mixins.scss I have the following code:

    add-border ($size, $color, $position) { $position == 'all' { border: $size solid $color; } if $position == 'top' { border-top: $size solid $color; } if $position == 'bottom' { border-bottom: $size solid $color; } if $position == 'right' { border-right: $size solid $color; } if $position == 'left' { border-left: $size solid $color; } if $position == 'top-bottom' { border-top: $size solid $color; border-bottom: $size solid $color; } if $position == 'right-left' { border-right: $size solid $color; border-left: $size solid $color; } }

    After that I am including it in the _nav.scss (They are in two separate folders):

    .navbar{ width: 90%; margin: auto; add-border(1px; #e7e7e7, 'right-left'); }

    This is in the main.scss:

    /* base style */

    'base/_variables.scss'; 'base/_mixins.scss'; 'base/_base.scss'; 'base/_normalize.scss';

    /* layots style */

    'layouts/_nav.scss'; 'layouts/_header.scss'; 'layouts/_footer.scss';

    /* modules style */

    'modules/_blocks.scss'; 'modules/_buttons.scss'; 'modules/_components.scss'; 'modules/_sections.scss'; 'modules/_typography.scss';

    I tried moving the imports of the "layout style" before the "base style" and it still doesn`t work. What could be the reason for that?

    Thank you in advance! :)

    点赞 评论 复制链接分享

相关推荐