Issue NG8001: ReadyToTalkComponent could not be recognized as a valid element - Module Angular 14 has already declared it

Upon updating to Angular 14, I ran into numerous errors, most of which were related to unknown elements. Despite declaring the component name under @NgModule in Declarations, the issues persisted. See the information below.

ng version

Angular CLI: 14.2.11
Node: 14.20.1
Package Manager: npm 6.14.17 
OS: darwin x64

Angular: 14.3.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1402.11
@angular-devkit/build-angular   14.2.11
@angular-devkit/core            15.2.8
@angular-devkit/schematics      15.2.8
@angular/cdk                    14.2.7
@angular/cli                    14.2.11
@angular/fire                   7.5.0
@angular/material               14.2.7
@ngtools/webpack                14.2.11
@nguniversal/express-engine     14.2.3
@schematics/angular             15.2.8
rxjs                            7.5.7
typescript                      4.8.4

shared.module.ts

import {NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import {CommonModule} from '@angular/common';
import {ReadyToTalkComponent} from './common/ready-to-talk/ready-to-talk.component';

@NgModule({
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  imports: [SOME_MODULES_HERE],
  declarations: [ ReadyToTalkComponent ],
  exports: [ ReadyToTalkComponent ]
})

export class SharedModule {}

app.module.ts

import { SharedModule } from './shared.module';

@NgModule({
  declarations: [SOME_COMPONENTS],
  imports: [ SharedModule ],
  providers: [SOME_SERVICES],
  bootstrap: [AppComponent]
})
export class AppModule { }

webinar.component.html

<app-ready-to-talk></app-ready-to-talk>

ready-to-talk.component.ts

@Component({
  selector: 'app-ready-to-talk',
  templateUrl: './ready-to-talk.component.html',
  styleUrls: ['./ready-to-talk.component.scss']
})

ERROR MESSAGE

Error: src/app/webinar/webinar.component.html:148:1 - error NG8001: 'app-ready-to-talk' is not a known element:
1. If 'app-ready-to-talk' is an Angular component, then verify that it is part of this module.
2. If 'app-ready-to-talk' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

Adding

schemas: [CUSTOM_ELEMENTS_SCHEMA]
in app.module.ts may be a potential solution, despite it being present in the Shared Module already.

Thank you!

EDITED: I found that setting "aot": false in angular.json eliminated the above error.

Answer №1

It may seem like common sense, but I found myself caught in this trap after updating Angular. Firstly, have you checked the ready-to-talk component for any issues? This could be the root cause of the error.

Another important step is to restart the CLI after resolving all other issues. If you haven't already, try closing VSCode and reopening your project

Answer №2

While it may not be my top choice, I have found that disabling the "aot": false setting in the angular.json file can effectively remove the error message.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

I'm trying to understand a JSON object that has multiple key names pointing to a single value. How can I properly interpret this in

Encountering an object with a strange key. const obj = { formValues: { 'TOTAL;_null_;_null_;3;_null_': "100" 'billing;_null_;_null_;1;_null_': "Y" 'billing;_null_;_null_;2;_null_': "Y" 'billi ...

Validating Linkedin URLs with JavaScript for Input Fields

I've created a basic form with an input field for a LinkedIn URL. Is there a way to validate that this field only accepts valid LinkedIn URLs? Thank you! ...

Getting the most out of TypeScript Enum in Angular 6

I have a situation where I am storing the numeric value of an enum in my database and then displaying it in another part of the UI. Now, I need to retrieve the string value linked with that numeric value from the enum in a separate Angular component. Here ...

Adhere" external documents onto a grid with the help of three.js

Currently, I am working in a .Stl editor on Three.js and I am facing the challenge of aligning my imported .Stl files to the grid properly. The issue is that they are ending up either partially above or below the grid, instead of sticking right onto it. I ...

Utilizing a React object incorporating "$$typeof" with the Symbol(react.element), for the purpose of inserting CSS classes

I'm currently working on enhancing the calendar by dynamically adding a CSS class to each day. For reference, I'm using the Material-UI Pickers library, and the DatePicker API is quite helpful: It seems like the key to achieving this is through ...

Retrieving values from objects using Typescript

I am facing an issue while trying to retrieve a value from an object. The key I need to use belongs to another object. Screenshot 1 Screenshot 2 However, when working with Typescript, I encounter the following error message. Error in Visual Studio Is ...

Customize the appearance of your apps script using conditional formatting to highlight values that are

https://i.stack.imgur.com/L1KFZ.png I need to create an array of all 50 US states based on the abbreviations in a column. The goal is to compare each cell against the array and if it doesn't match, format it red. After researching conditional format ...

Can anyone guide me on how to import an npm module in Vue.js?

Looking to integrate Discord RPC into my Electron browser application, I stumbled upon this npm module. I noticed that the default Node.js method of importing it doesn't work. My application simply ignores it when done that way. const client = requi ...

What is the best way to update a nested property in an object?

Consider the following object: myObject{ name: '...', label: '...', menuSettings: { rightAlignment: true, colours: [...], }, } I want to change the value of rightAlignment to fals ...

The dd accordion feature seems to be malfunctioning as it is not working as expected

I'm having an issue with a ddaccordion setup on my website. It seems to stay open all the time instead of functioning as expected. I've double-checked that the correct library is being called and there are no error messages in the console. To tr ...

I am experiencing difficulties connecting to Splunk using Javascript, but I am able to successfully connect with Java

Currently, I am attempting to establish a connection to Splunk using JavaScript. While I have successfully connected using Java and have full functionality, I keep encountering a 401 error when trying to connect with JavaScript. I am certain that my creden ...

Module not found in Node.js Express

Having trouble locating a module in Node.js Express Sample code provided below const express = require('express') const app = express() const port = 3000 app.get('/', (req, res) => { res.send('Hello World!') }) app.lis ...

Validation script needed for data list selection

<form action="order.php" method="post" name="myForm" id="dropdown" onsubmit="return(validate());"> <input list="From" name="From" autocomplete="off" type="text" placeholder="Starting Point"> <datalist id="From"> <option ...

Encountering a 500 internal server error while attempting to submit data to a Laravel project through Axios in Vue.js

I encountered an issue while attempting to send data to my Laravel application using Axios in Vue. The error I received was: Error: Request failed with status code 500 at e.exports (axios.min.js:8) at e.exports (axios.min.js:8) at XMLHttpReque ...

Utilizing Google Language API for bulk translation tasks

My current project involves using Google's AJAX Language API to translate each element in an array. for(var i=0; i < mytext.length; i++) { google.language.translate(mytext[i], originalLanguage, newLanguage, function(result){ if(!result.error){ ...

Making changes to a single formControl in angular6 will cause the other formControl to be updated as

I have two select menus in my user interface with the same options. When I select an option in one menu, I want the other menu to display the same option, and vice versa. Currently, I am using the valueChanges method on the first formControl to update the ...

A WordPress website featuring the impressive capabilities of the Three.js JavaScript 3D library

I attempted to integrate the Three.js JavaScript 3D library into my WordPress website by including three.min.js in various parts: Within the body of a post <script src="/three.min.js"></script> In the footer <script type='text/ ...

Access-Control-Origin header is missing, yet CORS Error persists despite being correctly set

My attempt to execute a Post Request to a PHP API is resulting in the error "no Access-Origin-Control header is set on the resource," despite the header being properly set. Interestingly, when I use Postman to make the request, everything works fine, and e ...

Issue with Domsanitizer bypasssecuritytruststyle functionality on Internet Explorer 11 not resolving

CSS:- Implementing the style property from modalStyle in TypeScript <div class="modal" tabindex="1000" [style]="modalStyle" > Angular Component:- Using DomSanitizer to adjust height, display, and min-height properties. While this configuration work ...

Steps for showing an alert with sweetalert when a condition is met

I am currently working on an Angular application and I am trying to display an alert using SweetAlert if a certain condition is met. How can I achieve this without the need for a click button? I attempted to implement the following code but it did not wor ...