gpt4 book ai didi

javascript - Angular 2 - 升级到 rc4 会引发脚本错误

转载 作者:行者123 更新时间:2023-11-28 18:28:04 24 4
gpt4 key购买 nike

我尝试将我的 Angular 2 版本更新到 2.0.0.rc.4,但在执行 npm install 、 npm start 后它会抛出脚本错误。

请引用下面我的 package.json 文件

"dependencies": {
"@angular/common": "2.0.0-rc.4",
"@angular/core": "2.0.0-rc.4",
"@angular/compiler": "2.0.0-rc.4",
"@angular/http": "2.0.0-rc.4",
"@angular/forms": "0.2.0",
"@angular/platform-browser": "2.0.0-rc.4",
"@angular/platform-browser-dynamic": "2.0.0-rc.4",
"@angular/router": "3.0.0-beta.1",
"@angular/router-deprecated": "2.0.0-rc.2",
"systemjs": "0.19.27",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12",
"core-js": "^2.4.0"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.1.0",
"typescript": "^1.8.7",
"typings":"^0.7.5"

}

下面是我的示例 app.component.ts 文件

import {Component} from '@angular/core';
import { bootstrap } from '@angular/platform-browser-dynamic';
import { disableDeprecatedForms, provideForms } from '@angular/forms';

import {CORE_DIRECTIVES, FORM_DIRECTIVES, FormBuilder,Validators,Control,ControlGroup } from '@angular/common';

@Component({
selector: 'ej-app',
templateUrl: 'app/app.component.html',
directives: [ CORE_DIRECTIVES]
})
bootstrap(AppComponent, [
disableDeprecatedForms(),
provideForms()
]).catch((err: any) => console.error(err));

export class AppComponent {

employeeDob: Date;
constructor(private myform: FormBuilder) {
}

此更改会引发如下所示的脚本错误 enter image description here

您能否建议毫无问题地更新 Angular 版本

最佳答案

更新您的 systemjs.config.js 文件。 .umd.js 文件的位置已更改为其自己的包文件夹:

var ngPackageNames = [
'common',
'compiler',
'core',
'forms',
'http',
'platform-browser',
'platform-browser-dynamic',
'router',
'router-deprecated',
'upgrade'
];

ngPackageNames.forEach(function(pkgName) {
packages['@angular/'+pkgName] = { main: 'bundles/' + pkgName + '.umd.js', defaultExtension: 'js' };
});

有关更多信息,请查看quickstart Angular2指南

关于javascript - Angular 2 - 升级到 rc4 会引发脚本错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38716206/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com