昨天我将我的项目升级到Angular v9。我在运行ng build
时遇到以下错误。
正在生成用于差异加载的ES5束。。。发生未处理的异常:C:\workspace\project\ui\pages-pages-module-es2015。js:ForInstancent左侧的属性预期节点的类型为[“VariableDeclaration”,“LVal”],但实际为空。有关详细信息,请参阅“C:\Users\sayoo\AppData\Local\Temp\ng BaceZi\angular errors.log”。
请在以下文件中找到:package.json
{
"name": "ui",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"start:ar": "ng serve --configuration=ar-IQ",
"build": "ng build",
"build:ar": "ng build --configuration=ar-IQ",
"test": "ng test",
"test:coverage": "ng test --code-coverage",
"lint": "ng lint",
"e2e": "ng e2e",
"int-extract": "ng xi18n --output-path src/locale",
"postinstall": "ngcc"
},
"private": true,
"dependencies": {
"@agm/core": "^1.0.0-beta.7",
"@angular/animations": "^9.0.5",
"@angular/common": "~9.0.5",
"@angular/compiler": "~9.0.5",
"@angular/core": "~9.0.5",
"@angular/forms": "~9.0.5",
"@angular/localize": "~9.0.5",
"@angular/platform-browser": "~9.0.5",
"@angular/platform-browser-dynamic": "~9.0.5",
"@angular/router": "~9.0.5",
"@fullcalendar/angular": "^4.2.1",
"@fullcalendar/bootstrap": "^4.2.0",
"@fullcalendar/core": "^4.2.0",
"@fullcalendar/daygrid": "^4.2.0",
"@fullcalendar/interaction": "^4.2.0",
"@fullcalendar/timegrid": "^4.2.0",
"@iplab/ngx-file-upload": "^1.4.0",
"@ng-bootstrap/ng-bootstrap": "^5.1.0",
"@ng-select/ng-select": "^3.0.3",
"angular-archwizard": "^4.0.0",
"animate.css": "^3.7.2",
"apexcharts": "^3.8.3",
"bootstrap": "^4.3.1",
"chart.js": "^2.8.0",
"chartist": "^0.11.3",
"core-js": "^2.5.4",
"karma-viewport": "^1.0.5",
"metismenujs": "^1.0.3",
"ng-apexcharts": "^1.0.5",
"ng-click-outside": "^4.0.0",
"ng2-charts": "^2.3.0",
"ng2-search-filter": "^0.5.1",
"ng5-slider": "^1.2.4",
"ngx-bootstrap": "^5.1.0",
"ngx-chartist": "^1.0.3",
"ngx-color-picker": "^8.1.0",
"ngx-drag-drop": "^2.0.0",
"ngx-editor": "^4.1.0",
"ngx-image-cropper": "^1.4.1",
"ngx-lightbox": "^2.0.1",
"ngx-mask": "^8.0.3",
"ngx-ui-switch": "^8.1.0",
"rxjs": "^6.5.2",
"smooth-scrollbar": "^8.3.1",
"sweetalert2": "^8.16.3",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.900.5",
"@angular/cli": "~9.0.5",
"@angular/compiler-cli": "~9.0.5",
"@angular/language-service": "~9.0.5",
"@types/node": "^12.11.1",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.7.5"
}
}
tsconfig。json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]
}
}
angular.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"ui": {
"i18n": {
"locales": {
"ar-IQ": {
"translation": "src/locale/messages.ar.xlf",
"baseHref": ""
}
}
},
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/ui",
"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": [
"src/assets/scss/bootstrap.scss",
"src/assets/scss/app.scss",
"src/assets/scss/icons.scss"
],
"scripts": [],
"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,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
},
"ar-IQ": {
"outputPath": "dist/ui-ar-iq/",
"i18nFile": "src/locale/messages.ar.xlf",
"i18nLocale": "ar-IQ",
"i18nMissingTranslation": "error"
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "ui:build",
"port": 4200,
"host": "falcon.me",
"disableHostCheck": true
},
"configurations": {
"production": {
"browserTarget": "ui:build:production"
},
"ar-IQ": {
"browserTarget": "ui:build:ar-IQ"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "ui: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": [
"src/assets/scss/bootstrap.scss",
"src/assets/scss/app.scss",
"src/assets/scss/icons.scss"
],
"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": "ui:serve"
},
"configurations": {
"production": {
"devServerTarget": "ui:serve:production"
}
}
}
}
}},
"defaultProject": "ui"
}
页。路由。单元
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
const routes: Routes = [
{ path: '', redirectTo: '/apps/obstacles', pathMatch: 'full' },
{ path: 'apps', loadChildren: () => import('./apps/apps.module').then(m => m.AppsModule) }
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class PagesRoutingModule { }
我正面临着同样的问题,并通过删除一个使用svg.js@2.7.1的包来解决!!!根据您的发现,此错误是由svg.js@2.7.1的停产版本引起的!!!看看你的应用程序里面有一个使用这个的包,然后删除它!
(注:对不起,可能在我的写作错误,我是巴西人,我不得不使用谷歌翻译写这)
临时解决方案:在@adang-devkit/build-角中发生了变化,更新了差分加载。要在Angular项目中解决此问题,请将tsconfig.json中的目标值从"es2015"更改为"es5":
{ "compileOnSave": false, "compilerOptions": { "baseUrl": "./", "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "module": "esnext", "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "importHelpers": true, "target": "es5", "typeRoots": [ "node_modules/@types" ], "lib": [ "es2018", "dom" ] } }
找到上述问题的解决方案。修复的步骤1.运行npm过时了。2.从包列表中更新红色的包到想要的版本。
出现未处理的异常:工作区中未设置配置es5。 当客户端希望项目在internet explorer 8上运行时,问题就开始了。幸运的是,新的angular 8提供了不同的负载。 根据文件(https://angular.io/guide/deployment#differential-加载)通过angular,我将ES5JSON添加到angular。json,然后我尝试使用“ng serve——配
我刚刚把我的Angular项目从版本8更新到了版本9。由于我必须支持IE11浏览器,目标是“es5”。 更新后,我在“为差异加载生成ES5捆绑包”时遇到以下错误 [1m[31mAn未处理的异常发生:C:\myproject\polyfills-es5.9b276c87455e9832d96d.js:编号(1:354893)[39m[22m[1m[31m[39m[22m]后的标识符 包裹json t
我在为生产构建项目时出错。另外,在生成es5捆绑包时花费的时间太多。 以下是我的版本:
我在下面尝试捕获JSON解析错误: 为什么在处理上述异常时,打印出另一个异常,以及如何解决它?
我刚刚下载了Eclipse Luna的最新版本,并立即安装了Aptana3.0插件。在这样做之后,我得到了一堆错误,与本文中列出的错误相同: “加载包[...]”期间发生内部错误 当我重新启动Eclipse时,我仍然遇到同样的错误,它似乎没有得到修复。
问题内容: 我有一个生成器和一个使用它的函数: 如果生成器引发异常,我想在使用者函数中处理该异常,然后继续使用迭代器,直到耗尽为止。请注意,我不想在生成器中有任何异常处理代码。 我想到了类似的东西: 但这对我来说看起来很尴尬。 问题答案: 这也是我不确定是否正确/优雅处理的事情。 我要做的是从生成器中获取一个,然后将其提升到其他位置。喜欢: 这样,我仍然继承了Exception而没有引发它,这将导