本文介绍了使用[email protected]执行ng build -prod时找不到模块css-loader的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下package.json配置

I have following package.json configuration

"dependencies": {
"@angular/common": "2.2.1",
"@angular/compiler": "2.2.1",
"@angular/core": "2.2.1",
"@angular/forms": "2.2.1",
"@angular/http": "2.2.1",
"@angular/platform-browser": "2.2.1",
"@angular/platform-browser-dynamic": "2.2.1",
"@angular/router": "3.2.1",
"@angular2-material/button": "^2.0.0-alpha.8-2",
"@angular2-material/button-toggle": "^2.0.0-alpha.8-2",
"@angular2-material/card": "^2.0.0-alpha.8-2",
"@angular2-material/checkbox": "^2.0.0-alpha.8-2",
"@angular2-material/core": "^2.0.0-alpha.8-2",
"@angular2-material/grid-list": "^2.0.0-alpha.8-2",
"@angular2-material/icon": "^2.0.0-alpha.8-2",
"@angular2-material/input": "^2.0.0-alpha.8-2",
"@angular2-material/list": "^2.0.0-alpha.8-2",
"@angular2-material/menu": "^2.0.0-alpha.8-2",
"@angular2-material/progress-bar": "^2.0.0-alpha.8-2",
"@angular2-material/progress-circle": "^2.0.0-alpha.8-2",
"@angular2-material/radio": "^2.0.0-alpha.8-2",
"@angular2-material/sidenav": "^2.0.0-alpha.8-2",
"@angular2-material/slide-toggle": "^2.0.0-alpha.8-2",
"@angular2-material/slider": "^2.0.0-alpha.8-2",
"@angular2-material/tabs": "^2.0.0-alpha.8-2",
"@angular2-material/toolbar": "^2.0.0-alpha.8-2",
"@angular2-material/tooltip": "^2.0.0-alpha.8-2",
"ng2-material-dropdown":"0.5.4",
"ng2-toasty": "^2.2.2",
"@types/hammerjs": "^2.0.30",
"angular2-cookie": "1.2.3",
"angular2-material-datepicker": "^0.5.0",
"angulartics2": "^1.1.9",
"core-js": "^2.4.1",
"d3": "^4.3.0",
"es6-shim": "0.35.1",
"ng2-datetime-picker": "^0.11.3",
"ng2-tag-input": "0.6.0",
"ng2-auto-complete":"0.8.2",
"reflect-metadata": "0.1.3",
"rickshaw": "^1.6.0",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23",
"ng2-file-upload": "^1.1.4-2",
"angular2-color-picker": "^1.3.0",
"@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.16"
  },
  "devDependencies": {
"@types/jasmine": "^2.2.30",
"angular-cli": "1.0.0-beta.21",
"codelyzer": "~0.0.26",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "4.0.5",
"ts-node": "1.2.1",
"tslint": "3.13.0",
"typescript": "2.0.2",
"typings": "1.3.1"

}

ng build -prod工作正常,但是突然之间,相同的配置出现以下错误

ng build -prod was working fine, however all of a sudden the same configuration gives the following error

ERROR in ./src/styles.css
Module build failed: Error: Cannot find module '/Volumes/DATA/new-    clone-test/nbw/node_modules/css-loader/index.js?sourcemap&minimize'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at loadLoader (/Volumes/DATA/new-clone-test/nbw/node_modules/loader-runner/lib/loadLoader.js:13:17)

我不确定是什么原因导致了此问题.任何帮助都感激不尽.

I am not sure what causes this issue. Any help will be much appreciated.

推荐答案

感谢Florinache!

Thanks to Florinache!

降级为angular-cli"1.0.0-beta.19-3"对我有用.从今天开始,我在所有项目中都遇到了同样的问题...

Downgrading to angular-cli "1.0.0-beta.19-3" works for me. I had the same issue from today on in all my projects...

{
  "devDependencies": {
       ...
       "angular-cli": "1.0.0-beta.19-3",
       ...
   }
}

这篇关于使用[email protected]执行ng build -prod时找不到模块css-loader的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 09:22