Javascript 创建react应用程序无法生成。这需要很长时间,然后出现错误
我已经创建了react项目v15并运行了npm运行build,运行build需要很长时间(20分钟)(比如冻结),然后得到了这个错误结果 如何解决这个问题Javascript 创建react应用程序无法生成。这需要很长时间,然后出现错误,javascript,reactjs,webpack,create-react-app,Javascript,Reactjs,Webpack,Create React App,我已经创建了react项目v15并运行了npm运行build,运行build需要很长时间(20分钟)(比如冻结),然后得到了这个错误结果 如何解决这个问题 enter code heresers/rice/my-app-2/node_modules/extract-text-webpack-plugin/dist/index.js:246 if (extractedChunk.getNumberOfModules()) { ^
enter code heresers/rice/my-app-2/node_modules/extract-text-webpack-plugin/dist/index.js:246
if (extractedChunk.getNumberOfModules()) {
^
TypeError: extractedChunk.getNumberOfModules is nota function
at ExtractTextPlugin.<anonymous> (/Users/rice/my-app-2/node_modules/extract-text-webpack-plugin/dist/index.js:246:32)
at Array.forEach (<anonymous>)
at Compilation.<anonymous> (/Users/rice/my-app-2/node_modules/extract-text-webpack-plugin/dist/index.js:245:27)
at Compilation.applyPluginsAsyncSeries (/Users/rice/my-app-2/node_modules/react-scripts/node_modules/tapable/lib/Tapable.js:206:13)
at sealPart2 (/Users/rice/my-app-2/node_modules/react-scripts/node_modules/webpack/lib/Compilation.js:636:9)
at next (/Users/rice/my-app-2/node_modules/react-scripts/node_modules/tapable/lib/Tapable.js:202:11)
at /Users/rice/my-app-2/node_modules/extract-text-webpack-plugin/dist/index.js:241:13
at /Users/rice/my-app-2/node_modules/async/dist/async.js:421:16
at iteratorCallback (/Users/rice/my-app-2/node_modules/async/dist/async.js:998:13)
at /Users/rice/my-app-2/node_modules/async/dist/async.js:906:16
at /Users/rice/my-app-2/node_modules/extract-text-webpack-plugin/dist/index.js:224:15
at /Users/rice/my-app-2/node_modules/async/dist/async.js:421:16
at iteratorCallback (/Users/rice/my-app-2/node_modules/async/dist/async.js:998:13)
at /Users/rice/my-app-2/node_modules/async/dist/async.js:906:16
at /Users/rice/my-app-2/node_modules/extract-text-webpack-plugin/dist/index.js:213:21
at rebuilding.forEach.cb (/Users/rice/my-app-2/node_modules/react-scripts/node_modules/webpack/lib/Compilation.js:504:29)
error An unexpected error occurred: "Command failed.
Exit code: 1
Command: sh
Arguments: -c react-scripts build
Directory: /Users/rice/my-app-2
Output:
".
info If you think this is a bug, please open a bug report with the information provided in "/Users/rice/my-app-2/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
在此处输入code/rice/my-app-2/node_modules/extract text webpack plugin/dist/index.js:246
if(extractedChunk.getNumberOfModules()){
^
TypeError:extractedChunk.getNumberOfModules不是函数
在ExtractTextPlugin上。(/Users/rice/my-app-2/node_modules/ExtractText-webpack-plugin/dist/index.js:246:32)
在Array.forEach()处
编译时。(/Users/rice/my-app-2/node_modules/extract text webpack plugin/dist/index.js:245:27)
在Compilation.applypluginasyncSeries(/Users/rice/my-app-2/node_modules/react scripts/node_modules/tapable/lib/tapable.js:206:13)
在sealPart2(/Users/rice/my-app-2/node_modules/react scripts/node_modules/webpack/lib/Compilation.js:636:9)
接下来(/Users/rice/my-app-2/node_modules/react scripts/node_modules/tapable/lib/tapable.js:202:11)
at/Users/rice/my-app-2/node_modules/extract text webpack plugin/dist/index.js:241:13
at/Users/rice/my-app-2/node_modules/async/dist/async.js:421:16
在iteratorCallback(/Users/rice/my-app-2/node_modules/async/dist/async.js:998:13)
at/Users/rice/my-app-2/node_modules/async/dist/async.js:906:16
at/Users/rice/my-app-2/node_modules/extract text webpack plugin/dist/index.js:224:15
at/Users/rice/my-app-2/node_modules/async/dist/async.js:421:16
在iteratorCallback(/Users/rice/my-app-2/node_modules/async/dist/async.js:998:13)
at/Users/rice/my-app-2/node_modules/async/dist/async.js:906:16
at/Users/rice/my-app-2/node_modules/extract text webpack plugin/dist/index.js:213:21
在rebuilding.forEach.cb(/Users/rice/my-app-2/node_modules/react scripts/node_modules/webpack/lib/Compilation.js:504:29)
错误发生意外错误:“命令失败。
退出代码:1
命令:sh
参数:-c反应脚本生成
目录:/Users/rice/my-app-2
输出:
".
信息如果您认为这是一个bug,请打开一个bug报告,其中包含“/Users/rice/my-app-2/warn error.log”中提供的信息。
信息访问https://yarnpkg.com/en/docs/cli/run 有关此命令的文档。
也许您可以尝试删除节点\u modules
文件夹,然后再次运行npm install
重新安装模块。然后再次尝试运行
npm run build
。错误提示为“extractedChunk.getNumberOfModules不是函数”。您可能没有正确导出该函数,但如果看不到您的代码,则无法确定。此程序包模块来自create react app module=>extract text webpack插件。我不知道如何修复我的猜测是您应该将extractedChunk.getNumberOfModules()更改为extractedChunk.getNumberOfModules,而不使用()@MihaiT我已经改变了你的指导,结果是一样的。我看到了这个确切的问题-有进展吗?