[英]Angular2 upgrade to RC6, traceur not found
After upgrade to RC6
, following errors occurs: 升级到
RC6
,发生以下错误:
zone.js:101 GET http://localhost/traceur 404 (Not Found)
zone.js:484 Unhandled Promise rejection: Error: XHR error (404 Not Found) loading http://localhost/traceur
at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost/vendor/zone.js/dist/zone.js:794:30)
at ZoneDelegate.invokeTask (http://localhost/vendor/zone.js/dist/zone.js:365:38)
at Zone.runTask (http://localhost/vendor/zone.js/dist/zone.js:265:48)
at XMLHttpRequest.ZoneTask.invoke (http://localhost/vendor/zone.js/dist/zone.js:433:34)
Error loading http://localhost/traceur
Error loading http://localhost/vendor/@angular/platform-browser-dynamic/index.js as "@angular/platform-browser-dynamic" from http://localhost/main.js ; Zone: <root> ; Task: Promise.then ; Value: Error: Error: XHR error (404 Not Found) loading http://localhost/traceur(…) null
zone.js:486 Error: Uncaught (in promise): Error: Error: XHR error (404 Not Found) loading http://localhost/traceur(…)
system.src.js:371 Assertion failed: loading or loaded
I understand that without code there is not easy to solve problem, but maybe someone have same error and figured it out. 我知道没有代码就不容易解决问题,但也许有人有同样的错误并想出来。
Existing posts not solving my problem 现有帖子没有解决我的问题
UPDATE: system.config.js: 更新: system.config.js:
// SystemJS configuration file, see links for more information
// https://github.com/systemjs/systemjs
// https://github.com/systemjs/systemjs/blob/master/docs/config-api.md
/***********************************************************************************************
* User Configuration.
**********************************************************************************************/
/** Map relative paths to URLs. */
const map: any = {
"ng2-charts": "vendor/ng2-charts",
'ng2-bs3-modal': 'vendor/ng2-bs3-modal',
'angular2-moment': 'vendor/angular2-moment',
"assets": "assets",
};
/** User packages configuration. */
const packages: any = {
"ng2-charts": {main: 'ng2-charts.js'},
"ng2-bs3-modal": {main: 'ng2-bs3-modal.js'},
"angular2-moment": {main: 'index.js'}
};
////////////////////////////////////////////////////////////////////////////////////////////////
/***********************************************************************************************
* Everything underneath this line is managed by the CLI.
**********************************************************************************************/
const barrels: string[] = [
// Angular specific barrels.
'@angular/core',
'@angular/common',
'@angular/compiler',
'@angular/forms',
'@angular/http',
'@angular/router',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
// Thirdparty barrels.
'rxjs',
// App specific barrels.
'app',
'app/shared',
'app/shared/navbar',
'app/shared/sidebar',
'app/shared/footer',
'app/dashboard',
'app/docs',
/** @cli-barrel */
];
const cliSystemConfigPackages: any = {};
barrels.forEach((barrelName: string) => {
cliSystemConfigPackages[barrelName] = { main: 'index' };
});
/** Type declaration for ambient System. */
declare var System: any;
// Apply the CLI SystemJS configuration.
System.config({
map: {
'@angular': 'vendor/@angular',
'rxjs': 'vendor/rxjs',
'main': 'main.js',
},
packages: cliSystemConfigPackages
});
// Apply the user's configuration.
System.config({ map, packages });
UPDATE 2: I changed system.config.js to following: 更新2:我将system.config.js更改为以下内容:
// SystemJS configuration file, see links for more information
// https://github.com/systemjs/systemjs
// https://github.com/systemjs/systemjs/blob/master/docs/config-api.md
/***********************************************************************************************
* User Configuration.
**********************************************************************************************/
/** Map relative paths to URLs. */
const map: any = {
"ng2-charts": "vendor/ng2-charts",
'ng2-bs3-modal': 'vendor/ng2-bs3-modal',
'angular2-moment': 'vendor/angular2-moment',
"assets": "assets",
};
/** User packages configuration. */
const packages: any = {
"ng2-charts": {main: 'ng2-charts.js'},
"ng2-bs3-modal": {main: 'ng2-bs3-modal.js'},
"angular2-moment": {main: 'index.js'}
};
////////////////////////////////////////////////////////////////////////////////////////////////
/***********************************************************************************************
* Everything underneath this line is managed by the CLI.
**********************************************************************************************/
const barrels: string[] = [
// App specific barrels.
'app',
'app/shared',
'app/shared/navbar',
'app/shared/sidebar',
'app/shared/footer',
'app/dashboard',
'app/docs',
/** @cli-barrel */
];
const cliSystemConfigPackages: any = {};
barrels.forEach((barrelName: string) => {
cliSystemConfigPackages[barrelName] = { main: 'index' };
});
/** Type declaration for ambient System. */
declare var System: any;
// Apply the CLI SystemJS configuration.
System.config({
map: {
'main': 'main.js',
},
packages: cliSystemConfigPackages
});
// Apply the user's configuration.
System.config({ map, packages });
System.config({
//use typescript for simple compilation (no typechecking)
//transpiler: 'typescript',
//typescript compiler options
//typescriptOptions: {
//emitDecoratorMetadata: true
//},
paths: {
'npm:': 'vendor/'
},
map: {
'app': './src',
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/core/testing': 'npm:@angular/core/bundles/core-testing.umd.js',
'@angular/common/testing': 'npm:@angular/common/bundles/common-testing.umd.js',
'@angular/compiler/testing': 'npm:@angular/compiler/bundles/compiler-testing.umd.js',
'@angular/http/testing': 'npm:@angular/http/bundles/http-testing.umd.js',
'@angular/platform-browser/testing': 'npm:@angular/platform-browser/bundles/platform-browser-testing.umd.js',
'@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js',
'@angular/router/testing': 'npm:@angular/router/bundles/router-testing.umd.js',
'rxjs': 'npm:rxjs'
},
//packages defines our app package
packages: {
app: {
main: './main.ts',
defaultExtension: 'ts'
},
rxjs: {
defaultExtension: 'js'
}
}
});
Now I getting following errors: 现在我收到以下错误:
zone.js:101 GET http://localhost/vendor/@angular/common/bundles/common.umd.js/src/directives/core_directives 404 (Not Found)
Good afternoon, I had the same issue all day. 下午好,我整天都有同样的问题。 After consulting several different links, I finally got it up and working by changing my system.config.ts to the following:
在咨询了几个不同的链接之后,我终于通过将我的system.config.ts更改为以下内容来解决它:
"use strict";
// SystemJS configuration file, see links for more information
// https://github.com/systemjs/systemjs
// https://github.com/systemjs/systemjs/blob/master/docs/config-api.md
/***********************************************************************************************
* User Configuration.
**********************************************************************************************/
/** Map relative paths to URLs. */
const map: any = {
"@angular": "vendor/@angular",
"rxjs": "vendor/rxjs",
"typescript": "node_modules/typescript/lib/typescript.js",
"materialize": "vendor/materialize-css",
"angular2-materialize": "vendor/angular2-materialize",
"jquery": "vendor/jquery"
};
/** User packages configuration. */
const packages: any = {
"materialize": {
"format": "global",
"main": "dist/js/materialize",
"defaultExtension": "js"
},
"angular2-materialize": {
"main": "dist/index",
"defaultExtension": "js"
},
"@angular/core": {
main: "bundles/core.umd.js" //use the ESM entry point for bundling tools
},
"@angular/common": {
main: "bundles/common.umd.js" //use the ESM entry point for bundling tools
},
"@angular/compiler": {
main: "bundles/compiler.umd.js" //use the ESM entry point for bundling tools
},
"@angular/forms": {
main: "bundles/forms.umd.js"
},
"@angular/http": {
main: "bundles/http.umd.js"
},
"@angular/platform-browser": {
main: "bundles/platform-browser.umd.js" //use the ESM entry point for bundling tools
},
"@angular/platform-browser-dynamic": {
main: "bundles/platform-browser-dynamic.umd.js" //use the ESM entry point for bundling tools
},
"@angular/router": {
main: "bundles/router.umd.js" //use the ESM entry point for bundling tools
},
};
////////////////////////////////////////////////////////////////////////////////////////////////
/***********************************************************************************************
* Everything underneath this line is managed by the CLI.
**********************************************************************************************/
const barrels: string[] = [
// Angular specific barrels.
"@angular/core",
"@angular/common",
"@angular/compiler",
"@angular/forms",
"@angular/http",
"@angular/router",
"@angular/platform-browser",
"@angular/platform-browser-dynamic",
// Thirdparty barrels.
"rxjs",
// App specific barrels.
"app"
/** @cli-barrel */
];
const cliSystemConfigPackages: any = {};
barrels.forEach((barrelName: string) => {
cliSystemConfigPackages[barrelName] = { main: "index" };
});
/** Type declaration for ambient System. */
declare var System: any;
// Apply the CLI SystemJS configuration.
System.config({
map: {
"@angular": "vendor/@angular",
"rxjs": "vendor/rxjs",
"jquery": "node-modules/jquery",
"materialize-css": "node-modules/materialize-css",
"angular2-materialize": "node_modules/angular2-materialize",
"main": "main.js"
},
packages: cliSystemConfigPackages
});
// Apply the user"s configuration.
System.config({ map, packages });
可以在此链接中找到查看应用更改的简便方法: https : //reviews.angular.io/R4 : 4f2bc6690486610c5736ce67ead984ba7ff1ce8d
Victorio, VICTORIO,
Thanks for sharing your working systems.config. 感谢您分享您的工作系统.config。 I used it to compare with mine and I just needed to remove the following line and got it fixed:
我用它来比较我的,我只需要删除以下行并修复它:
// No umd for router yet //还没有用于路由器的umd
packages['@angular/router'] = { main: 'index.js', defaultExtension: 'js' }; packages ['@ angular / router'] = {main:'index.js',defaultExtension:'js'};
This line comes with the Angular Quick Start RC5 tutorial. 这一行附带了Angular Quick Start RC5教程。
Again, 再次,
Thanks very much for sharing. 非常感谢分享。 I was struggling with it for a day.
我一天都在苦苦挣扎。 :-)
:-)
Cheers! 干杯!
i'm not sure if you have this resolved. 我不确定你是否解决了这个问题。 but, i ran across a fix that worked for me.
但是,我遇到了一个适合我的修复程序。 actually it's a bit less of a fix as it is a workaround.
实际上它只是一个修复,因为它是一个解决方法。
https://github.com/angular/angular/issues/10881 https://github.com/angular/angular/issues/10881
apparently there is some dumb multi-line comments issue with Angular parsing the NgModule file. 显然,Angular解析NgModule文件存在一些愚蠢的多行注释问题。 When migrating i copied my old main.ts inside of a
/* */
for reference. 迁移时,我将旧的main.ts复制到
/* */
以供参考。 took these lines out and ran perfectly. 把这些线拿出来跑完了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.