vue 更新 sass 版本出现大量警告的坑

知了小站
2021-11-24 / 5 评论 / 7,409 阅读

今天把 eladmin 项目部分依赖更新了下,其中 sass 版本号更新为 1.43.4 后出现了如下问题,项目能启动,但是伴随大量警告

kwcxhjlq.png

具体错误如下

 INFO  Starting development server...
 10% building 2/2 modules 0 activeℹ 「wds」: Project is running at http://localhost:8013/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from /Users/jie/Documents/work/me/front/eladmin-web/public
ℹ 「wds」: 404s will fallback to /index.html                                                                                                40% building 150/198 modules 48 active ...ules/element-ui/lib/mixins/migrating.jsDeprecation Warning: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div(1, 5)

More info and automated migrator: https://sass-lang.com/d/slash-div

    ╷
489 │ $--group-option-flex: 0 0 (1/5) * 100% !default;
    │                            ^^^
    ╵
    node_modules/element-ui/packages/theme-chalk/src/common/var.scss 489:28      @import
    node_modules/element-ui/packages/theme-chalk/src/common/transition.scss 1:9  @import
    node_modules/element-ui/packages/theme-chalk/src/base.scss 1:9               @import
    node_modules/element-ui/packages/theme-chalk/src/index.scss 1:9              @import
    src/assets/styles/element-variables.scss 25:9                                root stylesheet

Deprecation Warning: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div($--tooltip-arrow-size, 2)

More info and automated migrator: https://sass-lang.com/d/slash-div

   ╷
32 │     margin-right: #{$--tooltip-arrow-size / 2};
   │                     ^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
    node_modules/element-ui/packages/theme-chalk/src/popper.scss 32:21         @content
    node_modules/element-ui/packages/theme-chalk/src/mixins/mixins.scss 74:5   b()
    node_modules/element-ui/packages/theme-chalk/src/popper.scss 4:1           @import
    node_modules/element-ui/packages/theme-chalk/src/select-dropdown.scss 3:9  @import
    node_modules/element-ui/packages/theme-chalk/src/select.scss 4:9           @import
    node_modules/element-ui/packages/theme-chalk/src/pagination.scss 4:9       @import
    node_modules/element-ui/packages/theme-chalk/src/index.scss 2:9            @import
    src/assets/styles/element-variables.scss 25:9                              root stylesheet

Deprecation Warning: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div($--tooltip-arrow-size, 2)

More info and automated migrator: https://sass-lang.com/d/slash-div

   ╷
51 │     margin-right: #{$--tooltip-arrow-size / 2};
   │                     ^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
    node_modules/element-ui/packages/theme-chalk/src/popper.scss 51:21         @content
    node_modules/element-ui/packages/theme-chalk/src/mixins/mixins.scss 74:5   b()
    node_modules/element-ui/packages/theme-chalk/src/popper.scss 4:1           @import
    node_modules/element-ui/packages/theme-chalk/src/select-dropdown.scss 3:9  @import
    node_modules/element-ui/packages/theme-chalk/src/select.scss 4:9           @import
    node_modules/element-ui/packages/theme-chalk/src/pagination.scss 4:9       @import
    node_modules/element-ui/packages/theme-chalk/src/index.scss 2:9            @import
    src/assets/styles/element-variables.scss 25:9                              root stylesheet

Deprecation Warning: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div($--tooltip-arrow-size, 2)

More info and automated migrator: https://sass-lang.com/d/slash-div

   ╷
70 │     margin-bottom: #{$--tooltip-arrow-size / 2};
   │                      ^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
    node_modules/element-ui/packages/theme-chalk/src/popper.scss 70:22         @content
    node_modules/element-ui/packages/theme-chalk/src/mixins/mixins.scss 74:5   b()
    node_modules/element-ui/packages/theme-chalk/src/popper.scss 4:1           @import
    node_modules/element-ui/packages/theme-chalk/src/select-dropdown.scss 3:9  @import
    node_modules/element-ui/packages/theme-chalk/src/select.scss 4:9           @import
    node_modules/element-ui/packages/theme-chalk/src/pagination.scss 4:9       @import
    node_modules/element-ui/packages/theme-chalk/src/index.scss 2:9            @import
    src/assets/styles/element-variables.scss 25:9                              root stylesheet

Deprecation Warning: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div($--tooltip-arrow-size, 2)

More info and automated migrator: https://sass-lang.com/d/slash-div

   ╷
89 │     margin-bottom: #{$--tooltip-arrow-size / 2};
   │                      ^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
    node_modules/element-ui/packages/theme-chalk/src/popper.scss 89:22         @content
    node_modules/element-ui/packages/theme-chalk/src/mixins/mixins.scss 74:5   b()
    node_modules/element-ui/packages/theme-chalk/src/popper.scss 4:1           @import
    node_modules/element-ui/packages/theme-chalk/src/select-dropdown.scss 3:9  @import
    node_modules/element-ui/packages/theme-chalk/src/select.scss 4:9           @import
    node_modules/element-ui/packages/theme-chalk/src/pagination.scss 4:9       @import
    node_modules/element-ui/packages/theme-chalk/src/index.scss 2:9            @import
    src/assets/styles/element-variables.scss 25:9                              root stylesheet

Warning: 33 repetitive deprecation warnings omitted.
                                                                                          98% after emitting CopyPlugin                                                      
 DONE  Compiled successfully in 19257ms                                                                                                                         10:48:14 AM
                                                                                                                                                                           
  App running at:
  - Local:   http://localhost:8013/ 
  - Network: http://10.88.145.16:8013/

最开始以为是 element-ui 版本问题,修改版本后无果。

网上找到类似问题:

https://github.com/sass/dart-sass/issues/1319

解决办法 sass 版本修改为 1.32.13

"sass": "1.32.13"
本文共 82 个字数,平均阅读时长 ≈ 1分钟
9

打赏

评论 (5)

取消
  1. 头像
    白茶
    Windows 10 · Google Chrome

    但是element-plus 2.1.8 不用这个1.33.0的话 有会报math的错误

    回复
    1. 头像
      绿茶
      Windows 10 · Google Chrome
      @ 白茶

      我也是

      回复
  2. 头像
    冷冷的菜哥
    Windows 10 · Google Chrome

    升级sass到1.33.0或者1.34.0试试

    回复
  3. 头像
    ngj
    Windows 10 · Google Chrome

    sass换成1.32.13了 但是scss还是报错无法允许 有什么办法吗

    回复
    1. 头像
      知了小站 作者
      MacOS · Google Chrome
      @ ngj

      无法允许是啥意思

      回复