当我将依赖关系从角度2升级到角度5时,出现了sass-loader错误

时间:2018-04-25 00:30:15

标签: angular angular-cli

这是我的package.json:

{
  "name": "web-app",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "start": "ng serve",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "5.2.0", // from 2.0.2
    "@angular/compiler": "5.2.0", // from 2.0.2
    "@angular/core": "5.2.0", // from 2.0.2
    "@angular/forms": "5.2.0", // from 2.0.2
    "@angular/http": "5.2.0", // from 2.0.2
    "@angular/platform-browser": "5.2.0", // from 2.0.2
    "@angular/platform-browser-dynamic": "5.2.0", // from 2.0.2
    "@angular/router": "5.2.0", // from 3.0.0
    "angular2-google-maps": "0.16.0",
    "angular2-material-datepicker": "0.5.0",
    "core-js": "2.4.1",
    "js-marker-clusterer": "^1.0.0",
    "marker-clusterer-plus": "^2.1.4",
    "moment": "2.17.1",
    "ng2-inline-svg": "1.0.0",
    "rxjs": "5.5.6", // from 5.0.0-beta.12
    "ts-helpers": "1.1.1",
    "zone.js": "0.6.23"
  },
  "devDependencies": {
    "@angular/cli": "1.7.4", // added due to deprecated angular-cli
    "@angular/compiler-cli": "5.2.0", // added due to deprecated angular-cli
    "@angular/language-service": "5.2.0",
    "@types/jasmine": "2.8.3",
    "@types/jasminewd2": "2.0.2",
    "@types/node": "6.0.60",
    "codelyzer": "4.0.1",
    "jasmine-core": "2.8.0",
    "jasmine-spec-reporter": "4.2.1",
    "karma": "2.0.0",
    "karma-chrome-launcher": "2.2.0",
    "karma-coverage-istanbul-reporter": "1.2.1",
    "karma-jasmine": "1.1.0",
    "karma-jasmine-html-reporter": "0.2.2",
    "protractor": "5.1.2",
    "ts-node": "4.1.0",
    "tslint": "5.9.1",
    "typescript": "2.5.3",
    "@types/googlemaps": "3.30.8", //from 3.26.10
    "@types/webpack": "2.2.8",
    "bower": "1.8.0",
    "karma-cli": "1.0.1",
    "karma-remap-istanbul": "0.2.1",
    "webpack": "2.1.0-beta.22"
  }
}

我尝试更新一些版本(如package.json文件中所述) 我的大部分更新都是将角度2升级到5,将角度cli升级为角度/ cli

npm install成功,但是当我尝试构建时,我收到了这个错误:

ERROR in ./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/sass-loader/lib/loader.js??ref--8-3!./src/styles.sass
Module build failed:
  color: rgba(79, 79, 79, 0.5)
                                ^
      Invalid CSS after "...79, 79, 0.5); }": expected 1 selector or at-rule, was "-ms-input-placehold"
      in C:\Users\user\Work\web\web-ang2\src\assets\styles\fragments\_input.sass (line 5, column 34)
ERROR in src/app/components/secure/business/contractor-search/contractor-search.component.spec.ts(27,7): error TS1005: ',' expected.

也许我升级了一些彼此不兼容的版本。 怎么解决这个问题?

1 个答案:

答案 0 :(得分:0)

对于兼容性问题,我建议:

  1. 删除您的node_modules文件夹
  2. npm upgrade
  3. npm update
  4. 尽管如此,您的错误代码表明自定义文件中存在 (\assets\styles\fragments\_input.sasscontractor-search.component.spec.ts),而不是依赖项中存在问题。

    我强烈建议您删除任何空格 - 您是否从具有不同本地化设置的系统中移动代码?或者您是否以任何方式转换了任何文件?可能只是框架试图解析的一些随机空格。或者当你不看时,也许只是猫走过键盘? :P