首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何解决我的SharePointFramework中的这个插件sass错误?

如何解决我的SharePointFramework中的这个插件sass错误?
EN

Stack Overflow用户
提问于 2020-12-01 23:16:30
回答 1查看 344关注 0票数 0

我是SharePointFramework的新手。我开始了我的第二个webpart项目,并下载了这个框架,任何时候我运行** gulp **时,都会用** yo @microsoft/sharepoint **来下载包,这个sass错误总是弹出。注意:我使用的是NVM,它当前运行在版本10.19.0 ** package.json文件**上

代码语言:javascript
复制
{
  "name": "react-list-info",
  "version": "0.0.1",
  "private": true,
  "main": "lib/index.js",
  "engines": {
    "node": ">=0.10.0"
  },
  "scripts": {
    "build": "gulp bundle",
    "clean": "gulp clean",
    "test": "gulp test"
  },
  "dependencies": {
    "@microsoft/sp-core-library": "~1.1.0",
    "@microsoft/sp-webpart-base": "~1.1.0",
    "@microsoft/sp-lodash-subset": "~1.1.0",
    "@microsoft/sp-office-ui-fabric-core": "~1.4.0-0"
  },
  "devDependencies": {
    "@microsoft/sp-build-web": "~1.1.0",
    "@microsoft/sp-module-interfaces": "~1.1.0",
    "@microsoft/sp-webpart-workbench": "~1.1.0",
    "gulp": "~3.9.1",
    "@types/chai": "3.4.34",
    "@types/mocha": "2.2.38",
    "ajv": "~5.2.2",
    "@types/webpack-env": "1.13.1",
    "@types/es6-promise": "0.0.33"
  }
}

**WebPart.module.scss文件**

代码语言:javascript
复制
@import "~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss";

. {
  .container {
    max-width: 700px;
    margin: 0px auto;
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
  }

  .row {
    @include ms-Grid-row;
    @include ms-fontColor-white;
    background-color: $ms-color-themeDark;
    padding: 20px;
  }

  .column {
    @include ms-Grid-col;
    @include ms-lg10;
    @include ms-xl8;
    @include ms-xlPush2;
    @include ms-lgPush1;
  }

  .title {
    @include ms-font-xl;
    @include ms-fontColor-white;
  }

  .subTitle {
    @include ms-font-l;
    @include ms-fontColor-white;
  }

  .description {
    @include ms-font-l;
    @include ms-fontColor-white;
  }

  .button {
    // Our button
    text-decoration: none;
    height: 32px;

    // Primary Button
    min-width: 80px;
    background-color: $ms-color-themePrimary;
    border-color: $ms-color-themePrimary;
    color: $ms-color-white;

    // Basic Button
    outline: transparent;
    position: relative;
    font-family: "Segoe UI WestEuropean", "Segoe UI", -apple-system,
      BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
    -webkit-font-smoothing: antialiased;
    font-size: $ms-font-size-m;
    font-weight: $ms-font-weight-regular;
    border-width: 0;
    text-align: center;
    cursor: pointer;
    display: inline-block;
    padding: 0 16px;

    .label {
      font-weight: $ms-font-weight-semibold;
      font-size: $ms-font-size-m;
      height: 32px;
      line-height: 32px;
      margin: 0 4px;
      vertical-align: top;
      display: inline-block;
    }
  }
}

**全错误控制台展示**

代码语言:javascript
复制
Error in plugin 'sass'
Message:
    src\webparts\WebPart.module.scss
Error: Invalid CSS after "...bricCore.scss';": expected 1 selector or at-rule, was ". {"     
        on line 1 of src/webparts/WebPart.module.scss
>> -fabric-core/dist/sass/SPFabricCore.scss';
   ------------------------------------------^

[18:44:29] Error - 'sass' sub task errored after 26 s
 "Errors found in sass file(s)."
[18:44:29] 'serve' errored after 26 s
[18:44:29]
[18:44:29] Finished subtask 'copy-static-assets' after 26 s
[18:44:29] ==================[ Finished ]==================
Error - 'sass' sub task errored after 26 s
 "Errors found in sass file(s)."
[18:44:30] Project react-list-info version: 0.0.1
[18:44:30] Build tools version: 2.5.3
[18:44:30] Node version: v10.19.0
[18:44:30] Total duration: 1.55 min
[18:44:30] Task errors: 1
EN

回答 1

Stack Overflow用户

发布于 2020-12-02 17:05:37

尝试运行:

代码语言:javascript
复制
npm shrinkwrap
npm install

Github中类似的问题:https://github.com/pnp/sp-dev-fx-webparts/issues/497

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65093237

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档