ng build在我的Angular 4项目上运行会出现此错误:
14% building modules 40/46 modules 6 active ...es\@angular\http\@angular\http.es5.js
An error occured during the build:
Error: No module factory available for dependency type: ContextElementDependency
at Compilation.addModuleDependencies (D:\dev\workspace\rep\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:213:21)
at Compilation.processModuleDependencies (D:\dev\workspace\rep\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:202:8)
at _this.buildModule.err (D:\dev\workspace\rep\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:350:14)
at building.forEach.cb (D:\dev\workspace\rep\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:147:27)
at Array.forEach (native)
at callback
Run Code Online (Sandbox Code Playgroud)
我已经在这个问题上阅读了关于github和stackoverflow的很多Q/A,但是没有对我有帮助.
正如答案所示,我已经删除了webpack,但这没有帮助.删除了node_modules,从package.json中删除了webpack,运行npm install,仍然没有帮助.清理了npm的缓存,从package.json中删除了webpack,运行npm install,仍然没有结果.许多其他类似的建议没有帮助.
当我从package.json中删除webpack并运行时,npm install我得到以下内容:
Cannot find module 'webpack/lib/node/NodeTemplatePlugin' Error: Cannot
find module 'webpack/lib/node/NodeTemplatePlugin'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (D:\dev\workspace\rep\node_modules\html-webpack-plugin\lib\compiler.js:11:26) …Run Code Online (Sandbox Code Playgroud) 在我在Angular 4中开发的应用程序中,用户可以将多部分文件上传到服务器中.文件很大.我需要显示文件上传过程的当前进度及其对用户的百分比,我该怎么办?
提前致谢!