Слетели компоненты в Angular
Учебный проект на Angular 11 После добавления в проект окна диалога у меня появилась следующая ошибка:
Error: src/app/app.component.html:3:1 - error NG8001: 'ng-sidebar-container' is not a known element:
1. If 'ng-sidebar-container' is an Angular component, then verify that it is part of this module.
2. If 'ng-sidebar-container' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
До этого ее не было. Я удалил папку node_modules. Выполнил
npm install
После чего у меня уже перестали видеться уже несколько компонентов:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import {HttpClientModule} from '@angular/common/http';
import {FormsModule} from '@angular/forms';
import {MatDialogModule} from '@angular/material/dialog';
Ошибка :
TS2307: Cannot find module '@angular/platform-browser' or its corresponding type declarations.
TS2307: Cannot find module '@angular/core' or its corresponding type declarations.
TS2307: Cannot find module '@angular/common/http' or its corresponding type declarations.
TS2307: Cannot find module '@angular/forms' or its corresponding type declarations.
Я стал их уже устанавливать по одному
npm i --save @angular/[email protected]
...
Но ошибка не уходит. Я уже пошел их устанавливать по второму кругу, но чет не помогает. Я так понимаю где-то идет конфликт версий.
Как в этом Angular понять какие версии компонентов дружат друг с другом? И как мне выбраться из этого замкнутого круга?
Вот что у меня установлено на данный момент:
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1100.7
@angular-devkit/build-angular 0.1100.7
@angular-devkit/core 11.0.7
@angular-devkit/schematics 11.0.7
@angular/animations 11.0.7
@angular/cdk 11.2.7
@angular/cli 11.0.7
@angular/material 11.0.4
@schematics/angular 11.0.7
@schematics/update 0.1100.7
rxjs 6.6.7
typescript 4.0.7
Еще при установки выдает такие предупреждения:
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
Но они и раньше были, и все работало.
Ответы (1 шт):
Проблема оказалась в самой IDEA. На зарубежном форуме нашел похожий вопрос. Оказалось, что IDEA при добавлении новых компонентов (точно не могу перевести), но что-то там блокирует. Это происходит редко, но такое бывает. Меня сбило с толку, что перестал видеться компонент, который до этого прекрасно работал. Проблема решилась перезагрузкой самой IDEA. Возможно есть какое-то решение этой проблемы, типа какие-то настройки прописать в самой IDE, но я такого не нашел.