`npm run serve: ssr
dealer-sites-app@0.0.0 serve: ssr C: \ Users \ ehsaan \ Desktop \ checkNow \ DealerSites.App узел local.js
Прослушивание: http://localhost:4000 ОШИБКА TypeError: $. Ajax не является функцией в ConfigService.module.exports ../ src / app / _configurationservice / config.service.ts.ConfigService.run (C: \ Users \ ehsaan \ Desktop \ checkNow \ DealerSites.App \ dist \ server.js: 132942: 11) `
Вот мой package.json
{
"name": "dealer-sites-app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"compile:server": "webpack --config webpack.server.config.js --progress --colors",
"serve:ssr": "node local.js",
"build:ssr": "npm run build:client-and-server-bundles && npm run compile:server",
"build:client-and-server-bundles": "ng build --prod && ng run DealerSitesApp:server:production",
"server": "node local.js",
"build:prod": "npm run build:ssr",
"serve:prerender": "node static.js",
"build:prerender": "npm run build:prod && node dist/prerender.js"
},
"private": true,
"dependencies": {
"@angular/animations": "^7.2.15",
"@angular/cdk": "^7.3.7",
"@angular/common": "^7.2.15",
"@angular/compiler": "^7.2.15",
"@angular/core": "^7.2.15",
"@angular/forms": "^7.2.15",
"@angular/http": "~7.2.0",
"@angular/material": "^7.3.7",
"@angular/platform-browser": "^7.2.15",
"@angular/platform-browser-dynamic": "^7.2.15",
"@angular/platform-server": "~7.2.0",
"@angular/router": "^7.2.15",
"@auth0/angular-jwt": "^2.1.2",
"@ng-toolkit/universal": "^7.1.2",
"@nguniversal/common": "0.0.0",
"@nguniversal/express-engine": "0.0.0",
"@nguniversal/module-map-ngfactory-loader": "0.0.0",
"alertifyjs": "^1.11.4",
"angular-colorbox": "^1.1.5",
"angular-font-awesome": "^3.1.2",
"angular2-jwt": "^0.2.3",
"angular2-text-mask": "^9.0.0",
"bootstrap": "^3.4.0",
"core-js": "^2.6.9",
"domino": "^2.1.3",
"express": "^4.17.1",
"font-awesome": "^4.7.0",
"jquery": "^3.4.1",
"jquery-colorbox": "^1.6.4",
"ngx-bootstrap": "^3.3.0",
"ngx-currency": "^2.0.0",
"ngx-mask": "^7.9.10",
"popper": "^1.0.1",
"rxjs": "~6.3.3",
"rxjs-compat": "^6.5.3",
"tslib": "^1.10.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.13.9",
"@angular/cli": "^7.3.9",
"@angular/compiler-cli": "^7.2.15",
"@angular/language-service": "^7.2.15",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/jquery": "^2.0.54",
"@types/node": "~8.9.4",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.6",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-loader": "^5.2.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.2.2",
"webpack-cli": "^3.3.9"
}
}
`
**Here is my angular.json**
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"DealerSitesApp": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/DealerSitesApp",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css"
],
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/bootstrap/dist/js/bootstrap.js",
"node_modules/alertifyjs/build/alertify.min.js",
"node_modules/jquery-colorbox/jquery.colorbox-min.js"
],
"es5BrowserSupport": true
},
"configurations": {
"production": {
"fileReplacements": [{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "DealerSitesApp:build"
},
"configurations": {
"production": {
"browserTarget": "DealerSitesApp:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "DealerSitesApp:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.css"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"DealerSitesApp-e2e": {
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "DealerSitesApp:serve"
},
"configurations": {
"production": {
"devServerTarget": "DealerSitesApp:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "DealerSitesApp"
}
**This is my app.module**
import { BrowserModule } from '@angular/platform-browser';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { APP_INITIALIZER, Injector, LOCALE_ID } from '@angular/core';
import { JwtModule } from '@auth0/angular-jwt';
import * as $ from 'jquery';
import { PaginationModule } from 'ngx-bootstrap';
import { BsDatepickerModule } from 'ngx-bootstrap';
import { NgxMaskModule, IConfig } from 'ngx-mask';
import { NgxCurrencyModule } from 'ngx-currency';
import { TextMaskModule } from 'angular2-text-mask';
import { AppComponent } from './app.component';
import { HeaderComponent } from './header/header.component';
import { FooterComponent } from './footer/footer.component';
import { NavComponent } from './nav/nav.component';
import { HomeComponent } from './home/home.component';
import { InventoryComponent } from './vehicles/vehicle-inventory/inventory.component';
import { FinancingComponent, SafePipe } from './financing/financing.component';
import { LocationComponent } from './location/location.component';
import { ContactComponent } from './contact/contact.component';
import { SidebarComponent } from './sidebar/sidebar.component';
import { VehicleDetailComponent } from './vehicles/vehicle-detail/vehicle-detail.component';
import { EmailDetailsComponent } from './vehicles/email-details/email-details.component';
import { RequestInfoComponent } from './vehicles/request-info/request-info.component';
import { ColorboxComponent } from './vehicles/colorbox/colorbox.component';
import { appRoutes } from './routes';
import { AppConstants } from './_models/constants';
import { TokenInterceptor } from './_services/token.interceptor';
import { AppInitializer } from './_configurationservice/app-initializer';
import { ConfigService } from './_configurationservice/config.service';
import { VehicleService } from './_services/vehicle.service';
import { StartupService } from './_services/startup.service';
import { SiteService } from './_services/site.service';
import { AuthService } from './_services/auth.service';
import { VehicleDetailResolver } from './_resolver/vehicle-detail.resolver';
import { InventoryListResolver } from './_resolver/inventory-list.resolver';
export function initialize_app(appInitializer: AppInitializer) {
return () => appInitializer.run();
}
export function tokenGetter() {
return localStorage.getItem('token');
}
// tslint:disable-next-line: ban-types
export function startupServiceFactory(startupservice: StartupService): Function {
return () => startupservice.load();
}
export let options: Partial<IConfig> | (() => Partial<IConfig>);
// export let customCurrencyMaskConfig = {
// align: 'left',
// allowNegative: false,
// allowZero: true,
// decimal: ',',
// precision: 3,
// prefix: '$',
// suffix: '',
// thousands: '.',
// nullable: true
// };
export let customCurrencyMaskConfig = {
align: 'left',
allowNegative: false,
allowZero: true,
decimal: ',',
precision: 0,
prefix: '$',
suffix: '',
thousands: ',',
nullable: true
};
@NgModule({
declarations: [
AppComponent,
SafePipe,
HomeComponent,
ContactComponent,
InventoryComponent,
FinancingComponent,
LocationComponent,
VehicleDetailComponent,
SidebarComponent,
EmailDetailsComponent,
HeaderComponent,
FooterComponent,
NavComponent,
ColorboxComponent,
RequestInfoComponent,
],
imports: [
BrowserModule,
FormsModule,
ReactiveFormsModule,
HttpClientModule,
BrowserAnimationsModule,
TextMaskModule,
NgxCurrencyModule.forRoot(customCurrencyMaskConfig),
RouterModule.forRoot(appRoutes, { useHash: true }),
BsDatepickerModule.forRoot(),
PaginationModule.forRoot(),
// JwtModule.forRoot({
// config:{
// tokenGetter:tokenGetter,
// whitelistedDomains: ['localhost:44346'],
// blacklistedRoutes: ['localhost:44346/api/auth']
// }
// })
],
providers: [
InventoryListResolver,
VehicleDetailResolver,
SiteService,
AuthService,
VehicleService,
AppInitializer,
AppConstants,
{
provide: ConfigService,
useClass: ConfigService,
deps: [AppConstants]
},
{
provide: APP_INITIALIZER,
useFactory: initialize_app,
deps: [AppInitializer],
multi: true
},
{
provide: HTTP_INTERCEPTORS,
useClass: TokenInterceptor,
multi: true
}
],
bootstrap: [AppComponent]
})
export class AppModule { }