2016-09-02 21 views
9

Sau khi nâng cấp lên RC6, lỗi sau đây xảy ra:Angular2 nâng cấp lên RC6, Traceur không tìm thấy

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 

Tôi hiểu rằng không có mã không có dễ dàng để giải quyết vấn đề, nhưng có lẽ ai đó có cùng một lỗi và figured it out .

bài viết hiện tại không giải quyết vấn đề của tôi

UPDATE: 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: tôi đã thay đổi system.config.js để sau:

// 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' 
    } 
    } 
}); 

Bây giờ tôi nhận được các lỗi sau:

zone.js:101 GET http://localhost/vendor/@angular/common/bundles/common.umd.js/src/directives/core_directives 404 (Not Found) 
+0

Các bạn đã cố gắng để cập nhật system.js.config https://gist.github.com/robwormald/29f3dcda1a06b955d83fccb2a94586eb? – yurzui

+0

Không, tôi sẽ cố gắng. System.config.js hiện tại trong bài đăng – ulou

+2

Tôi đang gặp sự cố tương tự. – bUKaneer

Trả lời

10

Xin chào, Tôi gặp vấn đề tương tự cả ngày. Sau khi trao đổi liên kết khác nhau, cuối cùng tôi đã nhận nó và làm việc bằng cách thay đổi system.config.ts của tôi như sau:

"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 }); 
+0

Bạn có cần thực hiện bất kỳ thay đổi nào đối với tệp xây dựng góc-cli không? Tôi sẽ thử điều này trong những ngày cuối tuần vì vậy sẽ rất tuyệt khi biết nếu có bất kỳ tập tin nào khác cần thay đổi! – bUKaneer

+0

Không, tôi thì không. Điều duy nhất tôi phải làm là thay đổi system-config.ts. Tôi đã thử nhiều thứ khác nhau, nhưng cuộn chúng lại, cho đến khi cuối cùng cũng có cấu hình này. –

+0

Hiện tại, tôi đã thực hiện giải pháp của bạn - Tôi đã dành khoảng bốn giờ để giải quyết vấn đề nhưng không thể làm được điều đó đúng - mặc dù tôi đã bị lạc lối bởi các thông báo lỗi traceur! – bUKaneer

0

Victorio,

Cám ơn chia sẻ systems.config làm việc của bạn. Tôi đã sử dụng nó để so sánh với tôi và tôi chỉ cần xóa dòng sau và đã sửa nó:

// Không có bộ định tuyến nào cho bộ định tuyến
gói ['@ angular/router'] = {main: 'index. js ', defaultExtension:' js '};

Đường này đi kèm với hướng dẫn Bắt đầu nhanh RC5 góc.

Một lần nữa,

Cảm ơn rất nhiều vì đã chia sẻ. Tôi đã đấu tranh với nó trong một ngày. :-)

Chúc mừng!

0

Tôi không chắc chắn nếu bạn đã giải quyết vấn đề này. nhưng, tôi đã chạy qua một bản sửa lỗi phù hợp với tôi. thực sự nó là một chút ít của một sửa chữa vì nó là một workaround.

https://github.com/angular/angular/issues/10881

rõ ràng có một số nhiều dòng bình luận vấn đề ngớ ngẩn với góc phân tích các tập tin NgModule. Khi di chuyển, tôi đã sao chép main.ts cũ của tôi vào trong một số /* */ để tham khảo. lấy những dòng này ra và chạy hoàn hảo.

+1

vấn đề liên quan đến nhận xét nhiều dòng bắt nguồn trong systemjs, sử dụng cụm từ thông dụng để tìm lệnh nhập. –

Các vấn đề liên quan