2017-09-25 77 views
0

更新NPM模塊後,我試圖運行ng build -prod這是以前工作正常,我不斷收到以下錯誤:類型錯誤「NPM更新」和「NG構建-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)

角CLI版本等:

@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

我'卡住,因爲我只是不能找出什麼是真的去了w^rong經過簡單的更新。

有什麼想法嗎?

+0

我還運行 – Baconbeastnz

+0

嘗試從'package.json'中刪除webpack運行'npm uninstall webpack --save-dev' –

回答

4

這爲我修好了。 (基本上,如果你看故宮日誌在安裝過程中,它說提取物,文本的WebPack - 插件需要的WebPack 3.1.0依賴

所以只要更新您的WebPack,如:

npm install [email protected] --save-dev 
+0

很好,這可能是一個選項..當然,對我來說,已經足以擺脫' webpack' from'package.json',因爲我不需要它,整個應用程序正在使用'Angular CLI',並且產品在Docker上'nginx' –

+0

是的,我想我可能會刪除carets和tidles從我的package.json我不能處理這樣的問題每次我部署在我的生產服務器上。 – Baconbeastnz

+1

它適合我!謝謝:) –

相關問題