rak*_*258 21 angularjs angular
构建于:2022-09-14T11:34:20.503Z - 哈希:c51f599b4586fb6d - 时间:7780ms
\n./src/main.ts - 错误:模块构建失败(来自 ./node_modules/@ngtools/webpack/src/ivy/index.js):\n错误:发出
\n./src/polyfills.ts - 错误:模块构建失败(来自 ./node_modules/@ngtools/webpack/src/ivy/index.js):\n错误:发出
\n错误:无法初始化 Angular 编译 - 无法读取 null 的属性(读取“fileName”)
\n** Angular Live Development Server 正在监听 localhost:4200,打开浏览器 http://localhost:4200/ **
\n\xc3\x97 编译失败。
\n这似乎是 Typescript 版本 >4.9.0 的问题。我还没有弄清楚那是什么,但一个可能的解决方法是,如果可以的话,将您的版本修改为 4.8.2,因为这个版本似乎没有这个问题。
如果我找到到底是什么导致了这个问题,我会再次发布。
小智 6
检查这个,可能会有所帮助, 这背后的基本原因可能是......对某些模块的递归调用。
例如
@NgModule({
declarations: [],
imports: [
CommonModule,
MatSliderModule,
MaterialModule
],
exports:[MatSliderModule]
})
export class MaterialModule { }
Run Code Online (Sandbox Code Playgroud)
在这里,Same MaterialModule正在导入 self。它增加了调用堆栈并导致上述错误。
这是一个条件。可能还有其他条件。
小智 3
尝试找到node_modules/@angular/compiler-cli/ngcc/ngcc_lock_file
文件并将其删除。或者只需删除您的node_modules文件夹并执行npm install