Angular '之后的类型错误;npm更新';和';ng build-prod';

Angular '之后的类型错误;npm更新';和';ng build-prod';,angular,npm,angular-cli,Angular,Npm,Angular Cli,在更新npm模块后,我尝试运行ng build-prod,以前运行得很好,但一直出现以下错误: TypeError:extractedChunk.getNumberOfModules不是函数 在ExtractTextPlugin。(/Users/myUserName/dev test/demo/node_modules/extract text webpack plugin/dist/index.js:246:32) at Array.forEach(本机) 在汇编时。(/Users/myUse

在更新npm模块后,我尝试运行
ng build-prod
,以前运行得很好,但一直出现以下错误:

TypeError:extractedChunk.getNumberOfModules不是函数
在ExtractTextPlugin。(/Users/myUserName/dev test/demo/node_modules/extract text webpack plugin/dist/index.js:246:32)
at Array.forEach(本机)
在汇编时。(/Users/myUserName/dev test/demo/node_modules/extract text webpack plugin/dist/index.js:245:27)
在Compilation.applypluginasyncSeries(/Users/myUserName/dev test/demo/node_modules/@angular/cli/node_modules/tapable/lib/tapable.js:206:13)
在sealPart2(/Users/myUserName/dev test/demo/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:653:9)
接下来(/Users/myUserName/dev test/demo/node_modules/@angular/cli/node_modules/tapable/lib/tapable.js:202:11)
在Compilation.Compilation.plugin(/Users/myUserName/dev test/demo/node_modules/@angular/cli/node_modules/webpack/lib/ProgressPlugin.js:111:6)
接下来(/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
在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
在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
在rebuilding.forEach.cb(/Users/myUserName/dev test/demo/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:521:29)
at Array.forEach(本机)
回调时(/Users/myUserName/dev test/demo/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:521:15)
在processModuleDependencies(/Users/myUserName/dev test/demo/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:540:5)
at\u combinedTickCallback(内部/流程/下一步\u 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

我被困住了,因为在一次简单的更新之后,我无法找出到底出了什么问题

有什么想法吗?

这为我解决了问题。(基本上,如果你在安装过程中查看npm日志,就会发现extract text webpack插件需要webpack 3.1.0依赖关系

因此,只需更新您的网页包,例如:

npm install webpack@3.1.0 --save-dev
这为我解决了这个问题。(基本上,如果你在安装过程中查看npm日志,就会发现extract text webpack插件需要webpack 3.1.0依赖关系。)

因此,只需更新您的网页包,例如:

npm install webpack@3.1.0 --save-dev

我也遇到了这个问题。尝试从
package.json
中删除网页包。运行
npm卸载网页包--保存开发
我也遇到了这个问题。尝试从
package.json
中删除网页包。运行
npm卸载网页包--保存开发
太好了。这可能是另一个选项。当然。对我来说,已经足够摆脱它了
webpack
来自
package.json
,因为我在那里根本不需要它。整个应用程序都是用
Angular CLI
完成的,prod在Docker
nginx
是的,我想我可能会从我的包中删除插入符号和tidle。json我不能每次在我的生产服务器上部署时都处理这样的问题。@Baconbeastnz:Create React应用程序在执行npm run build时出现问题。添加网页对我来说很有效。谢谢docGreat。这可能是另一个选项。。当然。对我来说,这足以从
包中删除
网页包
。json
,因为我根本不需要它。整个应用程序都是用
Angular CLI
完成的,而prod是在Docker
nginx
Yeah true上,我想我可能会从我的包中删除插入符号和提示。json我不能每次在我的生产服务器上部署时都处理这样的问题。@Baconbeastnz:Create React应用程序在执行npm run build时出现名称问题。添加网页包对我很有效。谢谢doc