在从 webpack2 迁移到webpack4以及从 Angular4迁移到Angular5的过程中,我遇到了 webpack 编译的奇怪错误(./node_modules/.bin/webpack-cli):
无法解析模块 @angular/core 中的错误
调试 webpack ( node --inspect-brk ./node_modules/.bin/webpack-cli
) 得到错误堆栈跟踪:
Error: Could not resolve module @angular/core
at StaticSymbolResolver.getSymbolByModule (.../node_modules/@angular/compiler/bundles/compiler.umd.js:29766:30)
at StaticReflector.findDeclaration (.../node_modules/@angular/compiler/bundles/compiler.umd.js:31635:63)
at StaticReflector.initializeConversionMap (.../node_modules/@angular/compiler/bundles/compiler.umd.js:31953:36)
at new StaticReflector (.../node_modules/@angular/compiler/bundles/compiler.umd.js:31571:14)
at Object.createAotCompiler (.../node_modules/@angular/compiler/bundles/compiler.umd.js:32957:44)
at AngularCompilerProgram._createCompiler (.../node_modules/@angular/compiler-cli/src/transformers/program.js:404:37)
at AngularCompilerProgram.get [as hostAdapter] (.../node_modules/@angular/compiler-cli/src/transformers/program.js:327:22)
at AngularCompilerProgram._createProgramWithBasicStubs (.../node_modules/@angular/compiler-cli/src/transformers/program.js:435:73)
at .../node_modules/@angular/compiler-cli/src/transformers/program.js:143:28
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
at Function.Module.runMain (module.js:684:11)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:613:3
但不幸的是,它仍然没有给出提示。
在 angular repo上报告了这个问题。