Ako vyriešiť problémy s vytvorením aplikácie a spustením servera v Angulari

Angular errors

Asi najväčšia nočná mora pre vývojárov sú aktualizácie od operačného systému až po rôzne vývojárske nástroje. S každou aktualizáciou hrozí, že niečo nebude fungovať. Inak tomu nie je ani pri tvorbe aplikácii v Angulari.

Ak chcete v súčasnosti vytvoriť aplikáciu v Angulari a spustiť ju na Linuxe, hneď budete mať niekoľko errorov. Od správnej konfigurácie súboru package.json až po spustenie servera. Žiaľ na internete nenájdete riešenie. Teda nájdete “hlúposti”.

Príklady riešení na internete

npm cache clean --force
npm install
"enableIvy": false,

Samozrejme ani jedno z uvedených ako aj ďalších riešení čo som našiel na internete nefunguje. Nakoniec som to vyriešil sám a vytvoril som na to video aj tento článok.

Na záver ešte prikladám chybové hlásenia.

Chyba pri vytváraní aplikácie

⠹ Installing packages (npm)...npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: my-demo-project@0.0.0
npm ERR! Found: jasmine-core@3.7.1
npm ERR! node_modules/jasmine-core
npm ERR!   dev jasmine-core@"~3.7.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer jasmine-core@">=3.8" from karma-jasmine-html-reporter@1.7.0
npm ERR! node_modules/karma-jasmine-html-reporter
npm ERR!   dev karma-jasmine-html-reporter@"^1.5.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /root/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-07-15T15_47_16_708Z-debug.log
✖ Package install failed, see above.
The Schematic workflow failed. See above.

Chyba pri spustení servera

Error: node_modules/@angular/platform-browser/platform-browser.d.ts:45:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/platform-browser) which declares BrowserModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

45 export declare class BrowserModule {
                        ~~~~~~~~~~~~~


Error: node_modules/@angular/router/router.d.ts:2801:22 - error NG6002: Appears in the NgModule.imports of AppRoutingModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/router) which declares RouterModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

2801 export declare class RouterModule {
                          ~~~~~~~~~~~~


Error: node_modules/@angular/router/router.d.ts:2801:22 - error NG6003: Appears in the NgModule.exports of AppRoutingModule, but could not be resolved to an NgModule, Component, Directive, or Pipe class.

This likely means that the library (@angular/router) which declares RouterModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

2801 export declare class RouterModule {
                          ~~~~~~~~~~~~


Error: src/app/app-routing.module.ts:10:14 - error NG6002: Appears in the NgModule.imports of AppModule, but itself has errors

10 export class AppRoutingModule { }
                ~~~~~~~~~~~~~~~~
https://www.mldgroup.com

Vyštudovaný top manažér pôsobiaci najmä ako manažér, marketér, softvérový inžinier, konzultant, bloger, YouTuber a zatiaľ neúspešný hudobník a producent. V rámci praxe pôsobil v rôznych odvetviach na rôznych pozíciách v malých aj veľkých firmách, vrátane spoluprác a partnerstiev s významnými firmami či poradenskými spoločnosťami.

Pridaj komentár

Vaša e-mailová adresa nebude zverejnená. Vyžadované polia sú označené *