最近我将节点 14 更新到节点 18.20.4。我更改了模板和相关组件,因此当我执行
ng serve
时,终端控制台中没有错误。但是,当我执行 npm run start
或 npm run webpack:dev
时,我会收到错误。
在 IntelliJ 终端控制台中:
ERROR in Error: Child compilation failed:
[eslint] Failed to load plugin '@typescript-eslint' declared in '--config': Cannot find module '@typescript-eslint/eslint-plugin'
Require stack:
- C:\Users\Zoran\IdeaProjects\__placeholder__.js
Referenced from: C:\Users\Zoran\IdeaProjects\.eslintrc.json
- child-compiler.js:174
[isb]/[html-webpack-plugin]/lib/child-compiler.js:174:18
- Compiler.js:627 finalCallback
[isb]/[webpack]/lib/Compiler.js:627:5
- Compiler.js:662
[isb]/[webpack]/lib/Compiler.js:662:11
- Compiler.js:1348
[isb]/[webpack]/lib/Compiler.js:1348:17
- task_queues:95 processTicksAndRejections
node:internal/process/task_queues:95:5
- task_queues:64 runNextTicks
node:internal/process/task_queues:64:3
- timers:447 process.processImmediate
node:internal/timers:447:9
1 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
webpack 5.94.0 compiled with 130 errors in 313531 ms
在网络浏览器终端控制台中:
core.mjs:3476 JIT compilation failed for injectable class PlatformNavigation {
static { this.ɵfac = _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵngDeclareFactory"]({ minVersion: "12.0.0", version: "18.2.1", ngImport: _angular_core__WEBPACK_IMPORTED_MOD…
getCompilerFacade @ core.mjs:3476
'Uncaught Error: The injectable 'PlatformNavigation' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available. The injectable is part of a library that has been partially compiled.
However, the Angular Linker has not processed the library such that JIT compilation is used as fallback. Ideally, the library is processed using the Angular Linker to become fully AOT compiled. Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server', or manually provide the compiler with 'import "@angular/compiler";' before bootstrapping.
at getCompilerFacade (core.mjs:3489:1)
at Module.ɵɵngDeclareFactory (core.mjs:38009:1)
at <static_initializer> (common.mjs:33:47)
at ./node_modules/@angular/common/fesm2022/common.mjs (common.mjs:25:1)
at __webpack_require__ (bootstrap:24:1)
at fn (hot module replacement:61:1)
at ./node_modules/@angular/platform-browser/fesm2022/platform-browser.mjs (localize.mjs:875:1)
at __webpack_require__ (bootstrap:24:1)
at fn (hot module replacement:61:1)
at ./src/main/webapp/app/app.main.ts (app.main.ts:3:27)'
还有一堆其他错误,例如:
ERROR in C:\Users\Zoran\IdeaProjects\isb\src\main\webapp\app\app.component.ts
12:33-66
[tsl] ERROR in C:\Users\Zoran\IdeaProjects\isb\src\main\webapp\app\app.component.ts(12,34)
TS2306: File 'C:/Users/Zoran/IdeaProjects/isb/src/main/webapp/app/core/icons/font-awesome-icons.ts' is not a module.
ERROR in C:\Users\Zoran\IdeaProjects\isb\src\main\webapp\app\app.component.ts
13:77-94
[tsl] ERROR in C:\Users\Zoran\IdeaProjects\isb\src\main\webapp\app\app.component.ts(13,78)
TS2306: File 'C:/Users/Zoran/IdeaProjects/isb/src/main/webapp/app/app.constants.ts' is not a module.
ERROR in ./src/main/webapp/app/shared/login/login.component.ts (C:\Users\Zoran\IdeaProjects\isb\src\main\webapp\app\shared\login\login.component.ts) 11:4-7
[tsl] ERROR in C:\Users\Zoran\IdeaProjects\isb\src\main\webapp\app\shared\login\login.component.ts(11,5)
TS2403: Subsequent variable declarations must have the same type. Variable '_c0' must be of type '() => string[]', but here has type 'string[]'.
ERROR in ./src/main/webapp/app/layouts/navbar/navbar.component.ts (C:\Users\Zoran\IdeaProjects\isb\src\main\webapp\app\layouts\navbar\navbar.component.ts) 19:4-7
[tsl] ERROR in C:\Users\Zoran\IdeaProjects\isb\src\main\webapp\app\layouts\navbar\navbar.component.ts(19,5)
TS2403: Subsequent variable declarations must have the same type. Variable '_c0' must be of type '() => string[]', but here has type '() => { exact: boolean; }'.
ERROR in ./src/main/webapp/app/admin/configuration/configuration.service.ts (C:\Users\Zoran\IdeaProjects\isb\src\main\webapp\app\admin\configuration\configuration.service.ts) 16:43-48
[tsl] ERROR in C:\Users\Zoran\IdeaProjects\isb\src\main\webapp\app\admin\configuration\configuration.service.ts(16,44)
TS2339: Property 'beans' does not exist on type 'unknown'.
ERROR in ./src/main/webapp/app/admin/logs/logs.component.ts (C:\Users\Zoran\IdeaProjects\isb\src\main\webapp\app\admin\logs\logs.component.ts) 12:4-7
[tsl] ERROR in C:\Users\Zoran\IdeaProjects\isb\src\main\webapp\app\admin\logs\logs.component.ts(12,5)
TS2403: Subsequent variable declarations must have the same type. Variable '_c0' must be of type '() => string[]', but here has type '(a0: any) => { total: any; }'.
...
我尝试了几乎所有可以在互联网上找到的建议解决方案,所以现在我的文件看起来像:
.eslintrc.json
:
{
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint/eslint-plugin",
"@angular-eslint/eslint-plugin"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@angular-eslint/recommended",
"prettier"
],
"ignorePatterns": [
"node_modules/",
"src/main/docker/",
"src/test/javascript/protractor.conf.js",
"src/test/javascript/jest.conf.js",
"webpack/",
"target/",
"build/",
"node/",
"postcss.config.js"
],
"parserOptions": {
"project": "./tsconfig.base.json"
},
"rules": {
"@angular-eslint/directive-selector": [
"error",
{ "type": "attribute", "prefix": "jhi", "style": "camelCase" }
],
"@angular-eslint/component-selector": [
"error",
{ "type": "element", "prefix": "jhi", "style": "kebab-case" }
],
"@typescript-eslint/tslint/config": [
"error",
{
"lintFile": "./tslint.json"
}
],
"@typescript-eslint/no-unused-vars": [
"warn",
{
"vars": "all",
"args": "after-used",
"ignoreRestSiblings": false
}
],
"@typescript-eslint/no-non-null-assertion": "off",
"no-console": "off"
}
}
tsconfig.json
:
{
"files": ["src/main/webapp/app/app.main.ts"],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.e2e.json"
}
]
}
tsconfig.app.json
:
{
"extends": "./tsconfig.base.json",
"files": ["src/main/webapp/app/app.main.ts"]
}
tsconfig.e2e.json
:
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"module": "commonjs"
}
}
tsconfig.base.json
:
{
"compilerOptions": {
"target": "ES2015",
"module": "esnext",
"lib": ["es2017", "dom"],
"strict": true,
"moduleResolution": "node",
"esModuleInterop": true,
"sourceMap": true,
"allowSyntheticDefaultImports": true,
"noImplicitAny": true,
"noEmitOnError": false,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"ignoreDeprecations": "5.0",
"skipLibCheck": true,
"outDir": "target/classes/static/app",
"baseUrl": "./",
"paths": {
"app/*": ["src/main/webapp/app/*"]
},
"importHelpers": true,
"downlevelIteration": true,
"declaration": false,
"forceConsistentCasingInFileNames": true,
"types": ["node"],
"typeRoots": [
"./node_modules/@types",
"./webpack"
]
},
"angularCompilerOptions": {
"enableIvy": true,
"strict": true,
"skipTemplateCodegen": false,
"enableResourceInlining": true,
"strictInputAccessModifiers": true,
"strictInjectionParameters": true,
"fullTemplateTypeCheck": true,
"strictTemplates": true,
"preserveWhitespaces": true
},
"include": [
"src/**/*.ts",
"webpack/**/*.d.ts",
"src/main/webapp/app/app.main.ts"
],
"exclude": [
"node_modules",
"dist"
]
}
angular.json
:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "isb",
"projects": {
"isb": {
"root": "",
"sourceRoot": "src/main/webapp",
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"skipTests": true,
"style": "scss"
},
"@schematics/angular:directive": {
"skipTests": true
},
"@schematics/angular:guard": {
"skipTests": true
},
"@schematics/angular:pipe": {
"skipTests": true
},
"@schematics/angular:service": {
"skipTests": true
}
},
"prefix": "jhi",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/isb",
"index": "src/main/webapp/index.html",
"main": "src/main/webapp/app/app.main.ts",
"polyfills": "src/main/webapp/app/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"assets": ["src/main/webapp/favicon.ico", "src/main/webapp/manifest.json", "src/main/webapp/robots.txt"],
"styles": ["src/main/webapp/content/scss/global.scss"],
"scripts": []
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"aot": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
},
"development": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"aot": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2kb",
"maximumError": "5kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"buildTarget": "isb:build"
},
"configurations": {
"production": {
"buildTarget": "isb:build:production"
},
"development": {
"buildTarget": "isb:build:development"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "tsconfig.app.json",
"exclude": ["**/node_modules/**"]
}
}
}
}
},
"cli": {
"packageManager": "npm",
"cache": {
"enabled": false
}
}
}
在我的
package.json
中有:
"scripts": {
"start": "npm run webpack:dev",
"start:jit": "cross-env BUILD_MODE=jit ng serve",
"start-tls": "npm run webpack:dev -- --env.tls",
"serve": "npm run start",
"build": "node --max_old_space_size=8192 ./node_modules/webpack/bin/webpack.js --config ./webpack/webpack.dev.js",
"build:aot": "cross-env BUILD_MODE=aot ng build --aot",
"build:jit": "cross-env BUILD_MODE=jit ng build",
"webpack:dev": "npm run webpack-dev-server -- --config webpack/webpack.dev.js --port=9060",
},
和:
"devDependencies": {
"@angular-builders/custom-webpack": "18.0.0",
"@angular-builders/jest": "18.0.0",
"@angular-devkit/build-angular": "18.1.3",
"@angular-eslint/eslint-plugin": "^18.2.0",
"@angular/cli": "^18.2.0",
"@angular/compiler": "^18.2.1",
"@angular/compiler-cli": "^18.2.1",
"@angular/service-worker": "^18.2.0",
"@babel/preset-env": "^7.25.4",
"@babel/preset-typescript": "^7.24.7",
"@babel/register": "^7.24.6",
"@types/jest": "29.5.12",
"@types/reflect-metadata": "^0.1.0",
"@typescript-eslint/eslint-plugin": "^8.2.0",
"@typescript-eslint/parser": "^8.2.0",
"angular2-template-loader": "^0.6.2",
"autoprefixer": "^10.4.20",
"browser-sync": "3.0.2",
"browser-sync-webpack-plugin": "2.3.0",
"eslint": "^9.9.1",
"eslint-config-jhipster": "^0.0.1",
"eslint-config-prettier": "^9.1.0",
"eslint-define-config": "^2.1.0",
"eslint-webpack-plugin": "4.2.0",
"file-loader": "^6.2.0",
"webpack": "^5.91.0",
"webpack-bundle-analyzer": "4.10.2",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4",
"webpack-merge": "6.0.1",
"webpack-notifier": "1.15.0",
"webpack-shell-plugin-next": "^2.3.2",
},
webpack.common.js
的一部分:
const plugins = [
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer']
}),
new webpack.DefinePlugin({
'process.env.VERSION': JSON.stringify(process.env.VERSION),
'process.env.DEBUG_INFO_ENABLED': JSON.stringify(process.env.DEBUG_INFO_ENABLED),
'process.env.SERVER_API_URL': JSON.stringify(SERVER_API_URL),
'process.env.BUILD_TIMESTAMP': JSON.stringify(process.env.BUILD_TIMESTAMP),
}),
new CopyWebpackPlugin({
patterns: [
{ from: path.resolve(__dirname, '../node_modules/swagger-ui-dist/'), to: 'swagger-ui', globOptions: { ignore: ['**/index.html'] }},
{ from: path.resolve(__dirname, '../node_modules/axios/dist/axios.min.js'), to: 'swagger-ui' },
{ from: path.resolve(__dirname, '../src/main/webapp/content/images/logo-jhipster.png'), to: 'logo-jhipster.png' },
{ from: path.resolve(__dirname, '../src/main/webapp/swagger-ui/'), to: 'swagger-ui' },
{ from: path.resolve(__dirname, '../src/main/webapp/content/'), to: 'content' },
{ from: path.resolve(__dirname, '../src/main/webapp/favicon.ico'), to: 'favicon.ico' },
{ from: path.resolve(__dirname, '../src/main/webapp/manifest.json'), to: 'manifest.json' },
{ from: path.resolve(__dirname, '../src/main/webapp/robots.txt'), to: 'robots.txt' },
],
}),
new MergeJsonWebpackPlugin({
output: {
groupBy: [
{ pattern: './src/main/webapp/i18n/sr/*.json', fileName: './i18n/sr.json' },
{ pattern: './src/main/webapp/i18n/en/*.json', fileName: './i18n/en.json' },
]
}
}),
new HtmlWebpackPlugin({
template: './src/main/webapp/index.html',
chunks: ['polyfills', 'main', 'global'],
chunksSortMode: 'manual',
inject: 'body',
base: '/'
}),
new AngularWebpackPlugin({
mainPath: utils.root(path.resolve(__dirname, 'app/app.main.ts')),
tsConfigPath: utils.root('tsconfig.json'),
sourceMap: true,
}),
new CircularDependencyPlugin({
exclude: /node_modules|test|target/,
include: /src/,
failOnError: true,
allowAsyncCycles: false,
cwd: process.cwd(),
onStart({ compilation }) {
console.log('Start detecting webpack modules cycles');
},
onDetected({ module: webpackModuleRecord, paths, compilation }) {
const dependencyPaths = paths.join(' -> ');
console.error(`Circular dependency detected: ${dependencyPaths}`);
compilation.errors.push(new Error(dependencyPaths));
},
onEnd({ compilation }) {
console.log('End detecting webpack modules cycles');
},
}),
];
module.exports = (options) => ({
mode: options.env,
resolve: {
extensions: ['.scss', '.css', '.ts', '.js'],
modules: ['node_modules'],
mainFields: ['es2015', 'browser', 'module', 'main'],
alias: {
'bootstrap': path.resolve(__dirname, 'node_modules/bootstrap'),
'bootswatch': path.resolve(__dirname, 'node_modules/bootswatch')
},
modules: [
path.resolve(__dirname, 'src'),
'node_modules'
]
},
stats: {
errorDetails: false,
children: false,
logging: 'verbose',
},
module: {
rules: [
{
test: /\.json$/,
type: 'json'
},
{
test: /\.(ts)$/,
use: ['ts-loader', 'angular2-template-loader'],
exclude: /node_modules/,
},
{
test: /\.(js)$/,
use: 'babel-loader',
exclude: /node_modules/,
},
{
test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
loader: '@ngtools/webpack'
},
{
test: /\.html$/,
type: 'asset/source',
generator: {
filename: 'assets/[name]-[contenthash].[ext]',
},
exclude: utils.root('src/main/webapp/index.html')
},
{
test: /\.(jpe?g|png|gif|svg|woff2?|ttf|eot)$/i,
loader: 'file-loader',
options: {
digest: 'hex',
hash: 'sha512',
name: 'content/[hash].[ext]',
esModule: false
}
},
{ test: /[\/\\]@angular[\/\\].+\.js$/, parser: { system: true } },
]
},
plugins: plugins,
});
webpack.dev.js:
const webpack = require('webpack');
const writeFilePlugin = require('write-file-webpack-plugin');
const { merge } = require('webpack-merge');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin');
const WebpackNotifierPlugin = require('webpack-notifier');
const discardComments = require('postcss-discard-comments');
const ESLintPlugin = require('eslint-webpack-plugin');
const path = require('path');
const sass = require('sass');
const utils = require('./utils.js');
const commonConfig = require('./webpack.common.js');
const ENV = 'development';
const options = {
env: process.env.NODE_ENV || 'development', // Example definition
tls: false,
stats: 'minimal' // example setting for stats, adjust as needed
};
module.exports = (options) => merge(commonConfig({ env: ENV }), {
mode: 'development',
devtool: 'inline-source-map',
devServer: {
static: {
directory: path.join(__dirname, 'src/target/classes/static/'),
},
proxy: [{
context: [
'/api',
'/services',
'/management',
'/swagger-resources',
'/v2/api-docs',
'/h2-console',
'/auth'
],
target: `http${options.tls ? 's' : ''}://localhost:8080`,
secure: false,
changeOrigin: options.tls
}],
watchFiles: {
paths: ['src/**/*', 'src/target/classes/static/**/*'],
options: {
ignored: /node_modules/
}
},
historyApiFallback: true,
client: {
overlay: {
warnings: false,
errors: true
}
},
compress: true,
port: 9000,
},
entry: {
global: path.resolve(__dirname, '../src/main/webapp/content/scss/global.scss'),
main: path.resolve(__dirname, '../src/main/webapp/app/app.main.ts')
},
output: {
path: path.resolve(__dirname, '../target/classes/static/'),
filename: 'app/[name].bundle.js',
chunkFilename: 'app/[id].chunk.js',
publicPath: '/'
},
module: {
rules: [
{
test: /\.scss$/,
use: [
'to-string-loader',
{ loader: 'css-loader', options: { sourceMap: true } },
'postcss-loader',
{ loader: 'sass-loader',
options: {
sourceMap: true,
sassOptions: {
includePaths: [
'src/main/webapp/content/scss',
'node_modules'
]
},
}
},
],
exclude: /(vendor\.scss|global\.scss)/ // Exclude vendor and global styles
},
{
test: /(vendor\.scss|global\.scss)/,
use: [
'style-loader',
{
loader: 'css-loader',
options: { sourceMap: true },
},
{
loader: 'postcss-loader',
options: {
sourceMap: true,
postcssOptions: {
plugins: [
discardComments({ removeAll: true }),
],
},
},
},
// {
// loader: 'resolve-url-loader',
// options: { sourceMap: true }
// },
{
loader: 'sass-loader',
options: {
sourceMap: true,
sassOptions: {
charset: false, // Disables automatic @charset insertion
includePaths: [
'src/main/webapp/content/scss',
'node_modules'
],
},
},
},
],
},
{
test: /\.css$/,
use: [
'style-loader', // Injects CSS into the DOM
{ loader: 'css-loader', options: { sourceMap: true } },
],
},
]
},
stats: process.env.JHI_DISABLE_WEBPACK_LOGS ? 'none' : options.stats,
plugins: [
process.env.JHI_DISABLE_WEBPACK_LOGS
? null
: new SimpleProgressWebpackPlugin({
format: options.stats === 'minimal' ? 'compact' : 'expanded'
}),
new webpack.HotModuleReplacementPlugin(),
new ESLintPlugin({
extensions: ['ts', 'js'],
context: '/src/main/webapp',
overrideConfigFile: '../isb/.eslintrc.json',
cache: false,
failOnError: false,
emitWarning: true,
baseConfig: {
parserOptions: {
project: path.resolve(__dirname, '../tsconfig.json')
}
}
}),
new FriendlyErrorsWebpackPlugin({
clearConsole: true,
onErrors: (severity, errors) => {
if (severity !== 'error') {
return;
}
errors.forEach(error => {
console.error(error.message);
});
},
}),
new WebpackNotifierPlugin({
title: 'Isb',
contentImage: path.join(__dirname, 'logo-jhipster.png')
}),
new BrowserSyncPlugin({
https: options.tls,
host: 'localhost',
port: 9000,
proxy: {
target: `http${options.tls ? 's' : ''}://localhost:9060`,
proxyOptions: {
changeOrigin: false
}
},
socket: {
clients: {
heartbeatTimeout: 60000
}
}
},
{
reload: false
}),
new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)/,
path.resolve(__dirname, 'src/main/webapp/')
),
new writeFilePlugin(),
new webpack.WatchIgnorePlugin({
paths: [
utils.root('src/test'),
]
})
].filter(Boolean),
watchOptions: {
ignored: /node_modules/,
aggregateTimeout: 300,
poll: 1000
},
performance: {
hints: false
},
optimization: {
minimize: false,
splitChunks: {
chunks: 'all'
}
},
cache: {
type: 'memory',
// buildDependencies: {
// config: [__filename] // Ensures cache is invalidated when Webpack config changes
// },
// cacheDirectory: path.resolve(__dirname, '.webpack_cache')
}
});
app.module.js 的一部分:
@NgModule({
declarations: [
AppComponent,
MainComponent,
],
imports: [
CommonModule,
FormsModule,
BrowserModule,
IsbSharedModule,
RouterModule.forRoot(APP_ROUTES),
HttpClientModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
},
}),
InfiniteScrollModule,
FontAwesomeModule,
],
exports: [],
providers: [
provideNgxWebstorage(
withNgxWebstorageConfig({ prefix: 'jhi', separator: '-', caseSensitive: true }),
withLocalStorage(),
withSessionStorage()
),
LocalStorageService,
SessionStorageService,
],
// bootstrap: [AppComponent],
bootstrap: [MainComponent],
})
export class IsbAppModule {}
app.component.ts:
import { Component, inject } from '@angular/core';
import { registerLocaleData } from '@angular/common';
import dayjs from '../../../../webpack/dayjs-wrapper';
import { FaIconLibrary } from '@fortawesome/angular-fontawesome';
import { NgbDatepickerConfig } from '@ng-bootstrap/ng-bootstrap';
import locale from '@angular/common/locales/sr';
import { ApplicationConfigService } from './core/config/application-config.service';
import { fontAwesomeIcons } from './core/icons/font-awesome-icons';
import { VERSION, DEBUG_INFO_ENABLED, SERVER_API_URL, BUILD_TIMESTAMP } from './app.constants';
@Component({
selector: 'jhi-app',
template: '<jhi-main></jhi-main>',
})
export class AppComponent {
private applicationConfigService = inject(ApplicationConfigService);
private iconLibrary = inject(FaIconLibrary);
private dpConfig = inject(NgbDatepickerConfig);
constructor() {
if (SERVER_API_URL) {
this.applicationConfigService.setEndpointPrefix(SERVER_API_URL);
} else {
console.error('SERVER_API_URL is not defined. Please check your environment configuration.');
// You might want to handle this case, e.g., by showing a warning in your app.
}
registerLocaleData(locale);
this.iconLibrary.addIcons(...fontAwesomeIcons);
this.dpConfig.minDate = { year: dayjs().subtract(100, 'year').year(), month: 1, day: 1 };
}
}
app.main.ts:
import './polyfills';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { ProdConfig } from './blocks/config/prod.config';
import { IsbAppModule } from './app.module';
import { SERVER_API_URL } from './app.constants';
import '@angular/compiler'; // Add this line to import the compiler
console.log('SERVER_API_URL: '+SERVER_API_URL);
ProdConfig();
// if ((module as any).hot) {
// (module as any).hot.accept();
// }
platformBrowserDynamic()
.bootstrapModule(IsbAppModule, { preserveWhitespaces: true })
.then(() => console.log('Application started'))
.catch(err => console.error(err));
java-版本 java 版本“17.0.9”2023-10-17 LTS Java(TM) SE 运行时环境(内部版本 17.0.9+11-LTS-201) Java HotSpot(TM) 64 位服务器 VM(内部版本 17.0.9+11-LTS-201,混合模式,共享)
节点--版本 v18.20.4
ng--版本 18.2.1
npm -v 10.8.1
所有如何解决错误的建议和想法都非常受欢迎,因为我真的被困住了!!!
您有很多问题,但大多数似乎都指出了
eslint
:
我建议尝试系统地追踪它,我已经能够识别出一些是
修复 ESLint 插件问题:@typescript-eslint/eslint-plugin
npm install @typescript-eslint/eslint-plugin --save-dev
npm install @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint --save-dev
检查 .eslintrc.json
的兼容性问题,以确保配置与已安装的 ESLint 版本兼容。