Angular 角度编译器(ivy?)不断抱怨使用了标识符/变量
每次我试图编译项目时,都会弹出这个错误Angular 角度编译器(ivy?)不断抱怨使用了标识符/变量,angular,Angular,每次我试图编译项目时,都会弹出这个错误 Error: ./node_modules/@angular/cdk/__ivy_ngcc__/fesm2015/scrolling.js 23:12 Module parse failed: Identifier 'ɵngcc0' has already been declared (23:12) File was processed with these loaders: * ./node_modules/@angular-devkit/build-
Error: ./node_modules/@angular/cdk/__ivy_ngcc__/fesm2015/scrolling.js 23:12
Module parse failed: Identifier 'ɵngcc0' has already been declared (23:12)
File was processed with these loaders:
* ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
* ./node_modules/@ngtools/webpack/src/ivy/index.js
You may need an additional loader to handle the result of these loaders.
| import * as ɵngcc3 from '@angular/cdk/collections';
|
> import * as ɵngcc0 from '@angular/core';
| import * as ɵngcc1 from '@angular/cdk/platform';
| import * as ɵngcc2 from '@angular/cdk/bidi';
我不知道从哪里开始调试这个。我试过用谷歌搜索错误代码,但没有用。以前似乎没有其他人犯过这个错误。重新启动ng serve
无法解决问题。我在项目中使用了Angular 11和Angular材质
如何修复此问题并阻止此错误代码弹出?我还发现:
closing VS Code,
then deleting the node_modules,
then opening VS Code
then running **npm install** worked.
伊恩你是否用
ng new
创建了一个干净的角度项目?您添加了什么自定义代码?你能分享一个示范错误的示例项目吗?您是从项目根目录中使用通用的ng-serve
,还是向其添加参数?您可以尝试删除节点\u模块并运行npm-install
@JeffryHouser是的,这是一个全新的项目。我用npm安装-g@angular/cli
,ng新的angular应用程序
,ng添加@angular/material
创建。我还使用了ng serve
。谢谢@mbojko,删除了/node\u模块
,并安装了npm软件包,解决了我的问题。谢谢