#angular
#угловой
Вопрос:
Я не могу устранить эту ошибку.
Я попытался перечислить внутреннюю версию, используемую angular-cli, используя приведенный ниже код :
npm ls @ngtools/webpack
И я также вручную установил @ngTools / webpack с той же версией angular-cli, используя :
установка npm @ngtools/webpack@11.0.5 —сохранить-dev
Но ошибка все еще сохраняется. Что я делаю не так?
Код ниже:
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import {MatIconModule} from '@angular/material/icon';
import {MatFormFieldModule } from '@angular/material/form-field';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import {ReactiveFormsModule} from '@angular/forms';
import { HomeComponent } from './PAGES/home/home.component';
import { FooterComponent } from './COMPONENTS/footer/footer.component';
import { CheckoutComponent } from './PAGES/checkout/checkout.component';
import { LoginComponent } from './PAGES/login/login.component';
import {HeaderComponent} from './COMPONENTS/header/header.component';
import { BannerComponent } from './COMPONENTS/banner/banner.component';
import {MatCardModule} from '@angular/material/card';
import { HttpClientModule } from '@angular/common/http';
import { ProductsComponent } from './COMPONENTS/products/products.component';
import { CheckoutProductsComponent } from './COMPONENTS/checkout-products/checkout-products.component';
import { CheckoutSubtotalComponent } from './COMPONENTS/checkout-subtotal/checkout-subtotal.component';
import {AngularFireModule} from '@angular/fire';
import { firebaseConfig } from './CONFIG/firebase.config';
@NgModule({
declarations: [
AppComponent,
HomeComponent,
FooterComponent,
CheckoutComponent,
LoginComponent,
HeaderComponent,
BannerComponent,
ProductsComponent,
CheckoutProductsComponent,
CheckoutSubtotalComponent
],
imports: [
BrowserModule,
AppRoutingModule,
MatIconModule,
BrowserAnimationsModule,
MatCardModule,
MatFormFieldModule,
HttpClientModule,
ReactiveFormsModule,
AngularFireModule.initializeApp(firebaseConfig)
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Вот файл angular.json ниже
angular.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"ecommerce-project": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/ecommerce-project",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.css",
"./node_modules/bootstrap/dist/css/boostrap.min.css"
],
"scripts": [
"node_modules/chart.js/dist/Chart.js",
"node_modules/hammerjs/hammer.min.js"
]
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "ecommerce-project:build"
},
"configurations": {
"production": {
"browserTarget": "ecommerce-project:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "ecommerce-project:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.css"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "ecommerce-project:serve"
},
"configurations": {
"production": {
"devServerTarget": "ecommerce-project:serve:production"
}
}
},
"deploy": {
"builder": "@angular/fire:deploy",
"options": {}
}
}
}
},
"defaultProject": "ecommerce-project",
"cli": {
"analytics": "1a9dce89-6789-45fa-85e6-98e39024c7d2"
},
"schematics": {
"@schematics/angular:component": {
"styleext": "scss"
}
}
}
Комментарии:
1. Вы пытались удалить свою
node_modules
папку и снова установить пакеты?2. Да, я пытался удалить как node_modules, так и файл package-lock.json и переустановить с помощью npm install, но это не сработало. Есть ли что-то, что я делаю неправильно?