类型错误“NPM更新”和“NG构建-prod”

类型错误“NPM更新”和“NG构建-prod”

问题描述:

更新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' –

这为我修好了。 (基本上,如果你看故宫日志在安装过程中,它说提取物,文本的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

它适合我!谢谢:) –