angular cli 6无法加载style.scss中的外部scss文件? node_modules / raw-loader / node_modules / postcss-loader / lib嵌入

时间:2018-07-06 11:17:14

标签: angular sass angular-cli-v6

  

./ src / styles.scss中的错误   (./node_modules/raw-loader!./node_modules/postcss-loader/lib ??嵌入!./ node_modules / sass-loader / lib / loader.js ?? ref--14-3!./ src / styles。 scss)   (使用值代替Error的实例)CssSyntaxError:   /Users/src/assets/sass/modules/partials/_landing.scss:5:16:   无法解析“ ../assests/images/header-bg.png”   '/ Users / src'

     

3 | } 4 | .inner-page-banner {

     
    

5 |背景:url(../ assests / images / header-bg.png)无重复中心;         | ^ 6 |背景尺寸:封面; 7 | / *背景附加:固定; * /

  
     

ℹwdm」:编译失败。

Angular.json

"build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/Yosso-buyer",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "src/styles.scss"
            ],
            "scripts": []
          },



"@angular-devkit/build-angular": "^0.6.8",
    "@angular/cli": "~6.0.8",
    "@angular/compiler-cli": "^6.0.3",
    "@angular/language-service": "^6.0.3",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^2.0.4",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.0",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "~2.7.2"



"@angular/animations": "^6.0.3",
    "@angular/common": "^6.0.3",
    "@angular/compiler": "^6.0.3",
    "@angular/core": "^6.0.3",
    "@angular/forms": "^6.0.3",
    "@angular/http": "^6.0.3",
    "@angular/platform-browser": "^6.0.3",
    "@angular/platform-browser-dynamic": "^6.0.3",
    "@angular/router": "^6.0.3",
    "bootstrap": "^4.1.1",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.5.4",
    "jquery": "^3.3.1",
    "popper.js": "^1.14.3",
    "rxjs": "^6.0.0",
    "web-animations-js": "^2.3.1",
    "zone.js": "^0.8.26"

enter image description here

1 个答案:

答案 0 :(得分:0)

错误似乎是路径错误:assests

'../assests/images/header-bg.png' in '/Users/src'

但在您拥有的资产下

"src/assets"