更新npm模块后,我尝试运行ng build -prod
之前工作正常,我一直收到以下错误:
TypeError: extractedChunk.getNumberOfModules is not a function
at ExtractTextPlugin.<anonymous> (/Users/myUserName/dev-test/demo/node_modules/extract-text-webpack-plugin/dist/index.js:246:32)
at Array.forEach (native)
at Compilation.<anonymous> (/Users/myUserName/dev-test/demo/node_modules/extract-text-webpack-plugin/dist/index.js:245:27)
at Compilation.applyPluginsAsyncSeries (/Users/myUserName/dev-test/demo/node_modules/@angular/cli/node_modules/tapable/lib/Tapable.js:206:13)
at sealPart2 (/Users/myUserName/dev-test/demo/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:653:9)
at next (/Users/myUserName/dev-test/demo/node_modules/@angular/cli/node_modules/tapable/lib/Tapable.js:202:11)
at Compilation.compilation.plugin (/Users/myUserName/dev-test/demo/node_modules/@angular/cli/node_modules/webpack/lib/ProgressPlugin.js:111:6)
at next (/Users/myUserName/dev-test/demo/node_modules/@angular/cli/node_modules/tapable/lib/Tapable.js:204:14)
at /Users/myUserName/dev-test/demo/node_modules/extract-text-webpack-plugin/dist/index.js:241:13
at /Users/myUserName/dev-test/demo/node_modules/async/dist/async.js:421:16
at iteratorCallback (/Users/myUserName/dev-test/demo/node_modules/async/dist/async.js:998:13)
at /Users/myUserName/dev-test/demo/node_modules/async/dist/async.js:906:16
at /Users/myUserName/dev-test/demo/node_modules/extract-text-webpack-plugin/dist/index.js:224:15
at /Users/myUserName/dev-test/demo/node_modules/async/dist/async.js:421:16
at iteratorCallback (/Users/myUserName/dev-test/demo/node_modules/async/dist/async.js:998:13)
at /Users/myUserName/dev-test/demo/node_modules/async/dist/async.js:906:16
at /Users/myUserName/dev-test/demo/node_modules/extract-text-webpack-plugin/dist/index.js:213:21
at rebuilding.forEach.cb (/Users/myUserName/dev-test/demo/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:521:29)
at Array.forEach (native)
at callback (/Users/myUserName/dev-test/demo/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:521:15)
at processModuleDependencies (/Users/myUserName/dev-test/demo/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:540:5)
at _combinedTickCallback (internal/process/next_tick.js:95:7)
Angular cli Version等:
@angular/cli: 1.4.3
node: 8.0.0
os: darwin x64
@angular/animations: 4.4.3
@angular/cdk: 2.0.0-beta.11
@angular/common: 4.4.3
@angular/compiler: 4.4.3
@angular/core: 4.4.3
@angular/flex-layout: 2.0.0-beta.9-0e7d2e0
@angular/forms: 4.4.3
@angular/http: 4.4.3
@angular/material: 2.0.0-beta.11
@angular/platform-browser: 4.4.3
@angular/platform-browser-dynamic: 4.4.3
@angular/platform-server: 4.4.3
@angular/router: 4.4.3
@angular/cli: 1.4.3
@angular/compiler-cli: 4.4.3
typescript: 2.3.4
npm版本:5.4.2
我被卡住了,因为我无法通过简单的更新找出真正出错的地方。
有什么想法吗?
答案 0 :(得分:4)
这为我修好了。 (基本上如果你在安装过程中查看npm日志,它说extract-text-webpack-plugin需要webpack 3.1.0依赖。
所以只需更新你的webpack,例如:
npm install webpack@3.1.0 --save-dev