While Upgrading Angular 12 to 13, facing routing-outlet error in console though all the...

Discussão em 'Angular' iniciado por Preethi, Maio 2, 2025.

  1. Preethi

    Preethi Guest

    Am updating angular 12 to 13 and updated all dependency package to its compatible version. Checked by giving npm outdated, no package is showing the version in red color. When given npm start, application url is getting launched but getting console error related to routing module as mentioned below

    All the routing are correct, added RouterModule in AppModule and AppRoutingModule. Added in app component, added the path correctly in routing module. Still the routing is not taking place, even it is not navigating to the error page, { path: '**', redirectTo: '/error' } When i wrote console.log in resolver.ts and appcomponent.ts file, am getting those in console along with the mentioned error

    Error message:

    VM147 core.mjs:14757 NG0304: 'router-outlet' is not a known element:

    1. If 'router-outlet' is an Angular component, then verify that it is part of this module.
    2. If 'router-outlet' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

    Console messages

    MainAppComponent:constructor() - appcomponent.ts BaseUrlResolver:resolve() - resolver.ts

    Below is the output of my ng version command

    ng "version" _ _ ____ _ ___ / \ _ __ __ _ _ | | __ _ _ __ / | | | | / △ \ | ' \ / _ | | | | |/ _ | '| | | | | | | / ___ | | | | (| | || | | (| | | | || | | | // __| ||_, |_,||_,|| _||| |___/ Angular CLI: 13.3.11 Node: 14.15.5 Package Manager: npm 6.14.18 OS: win32 x64

    I tried the same with node version 16.20.2 with npm 8.19.4, but getting peer dependency error for webpack-dev-server and typescript. When i try to update that, its throwing error as circular dependency, if am updating typescript, its throwing error for webpack-dev, so if am trying to update webpack, its throwing error on typescript

    Note : We are using webpack and below i mentioned the versions

    "webpack": "^5.99.7",
    "webpack-cli": "^3.3.10",
    "webpack-dev-server": "^5.2.1",
    "webpack-merge": "^4.2.2",

    Continue reading...

Compartilhe esta Página