Angular 2升级到Angular 4 - 遇到npm模块问题,尝试降级,现在遇到了sass loader问题

时间:2017-05-21 11:23:15

标签: angular sass angular-cli

我尝试从Angular 2.4.1升级 - > Angular 4,我遇到了一些与我的某些npm模块相关的错误,所以我决定降级回到我的版本。现在的问题是,即使我将package.json恢复到以前的版本,删除了node_modules并运行npm install,我现在也收到了这些错误,我不明白为什么:

ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader!./~/sass-loader/lib/loader.js!./src/styles.scss
Module not found: Error: Can't resolve '../node_modules/font-awesome/css/font-awesome.css' in '/Applications/MAMP/htdocs/rosebud-web/src'
 @ ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader!./~/sass-loader/lib/loader.js!./src/styles.scss 3:10-190
 @ ./src/styles.scss
 @ multi ./src/styles.scss ./~/ng2-toasty/style-default.css

我还需要做些什么吗?我没有用css加载器触摸任何东西,但它们搞砸了。

Here is is my package.json info:

"dependencies": {
    "@angular/common": "^2.4.0",
    "@angular/compiler": "^2.4.0",
    "@angular/core": "^2.4.0",
    "@angular/forms": "^2.4.0",
    "@angular/http": "^2.4.0",
    "@angular/platform-browser": "^2.4.0",
    "@angular/platform-browser-dynamic": "^2.4.0",
    "@angular/router": "^3.4.0",
    "@types/jspdf": "^1.1.31",
    "@types/lodash": "^4.14.36",
    "@types/request": "0.0.30",
    "angular2-focus": "^1.1.0",
    "angular2-moment": "^1.3.0",
    "angular2-signaturepad": "^2.2.0",
    "angularfire2": "^2.0.0-beta.4",
    "core-js": "^2.4.1",
    "firebase": "^3.6.6",
    "firebase-queue": "^1.5.0",
    "jspdf": "^1.3.3",
    "lodash": "^4.15.0",
    "ng-semantic": "^1.1.13",
    "ng2-datepicker": "^1.8.2",
    "ng2-file-upload": "^1.2.0",
    "ng2-toasty": "^4.0.0",
    "rxjs": "^5.1.0",
    "zone.js": "^0.7.6"
  },
  "devDependencies": {
    "@angular/cli": "1.0.0-beta.32.3",
    "@angular/compiler-cli": "^2.4.0",
    "@types/jasmine": "2.5.38",
    "@types/node": "~6.0.60",
    "angular-cli": "^1.0.0-beta.21",
    "codelyzer": "~2.0.0-beta.4",
    "firebase-server": "^0.9.1",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.4.2",
    "typescript": "~2.0.0"
  }

提前致谢!

2 个答案:

答案 0 :(得分:1)

如有疑问,请删除node_modules文件夹中的所有内容,然后运行" npm install"试。

答案 1 :(得分:0)

错误显示您正在导入font-awesome,但是您的package.json没有显示它正在安装。以前可能需要它作为依赖项,这就是它出现在node_modules中而不再出现的原因。