将Angular2应用程序移动到新系统时,traceur会导致什么错误?

我有一个build立在Angular2 RC5中的应用程序。 我在Angular2-Beta2.0.0中启动了我的应用程序。 我正试图将应用程序复制到另一个系统来做进一步的开发。 主系统仍然可以正常工作,但是当我将相同的代码下载到第二个系统时,每次启动应用程序时都会收到此错误。 我无法在我的项目文件的任何地方findtraceur的提及。 我不知道这是什么。 该应用程序仍然在我的原始系统上正常工作。

zone.js:461 Unhandled Promise rejection: Error: XHR error (404 Not Found) loading http://localhost:4200/traceur 

任何人都知道这是什么,以及如何解决它?

整个错误

 zone.js:463 Error: Uncaught (in promise): Error: Error: XHR error (404 Not Found) loading http://localhost:4200/traceur at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:4200/vendor/zone.js/dist/zone.js:769:30) at ZoneDelegate.invokeTask (http://localhost:4200/vendor/zone.js/dist/zone.js:356:38) at Zone.runTask (http://localhost:4200/vendor/zone.js/dist/zone.js:256:48) at XMLHttpRequest.ZoneTask.invoke (http://localhost:4200/vendor/zone.js/dist/zone.js:423:34) Error loading http://localhost:4200/traceur Error loading http://localhost:4200/vendor/@angular/platform-browser-dynamic/index.js as "@angular/platform-browser-dynamic" from http://localhost:4200/main.js at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:4200/vendor/zone.js/dist/zone.js:769:30) at ZoneDelegate.invokeTask (http://localhost:4200/vendor/zone.js/dist/zone.js:356:38) at Zone.runTask (http://localhost:4200/vendor/zone.js/dist/zone.js:256:48) at XMLHttpRequest.ZoneTask.invoke (http://localhost:4200/vendor/zone.js/dist/zone.js:423:34) Error loading http://localhost:4200/traceur Error loading http://localhost:4200/vendor/@angular/platform-browser-dynamic/index.js as "@angular/platform-browser-dynamic" from http://localhost:4200/main.js at resolvePromise (http://localhost:4200/vendor/zone.js/dist/zone.js:538:32) at resolvePromise (http://localhost:4200/vendor/zone.js/dist/zone.js:523:18) at http://localhost:4200/vendor/zone.js/dist/zone.js:571:18 at ZoneDelegate.invokeTask (http://localhost:4200/vendor/zone.js/dist/zone.js:356:38) at Zone.runTask (http://localhost:4200/vendor/zone.js/dist/zone.js:256:48) at drainMicroTaskQueue (http://localhost:4200/vendor/zone.js/dist/zone.js:474:36) at XMLHttpRequest.ZoneTask.invoke (http://localhost:4200/vendor/zone.js/dist/zone.js:426:22)consoleError @ zone.js:463_loop_1 @ zone.js:490drainMicroTaskQueue @ zone.js:494ZoneTask.invoke @ zone.js:426 

的package.json

 { "name": "prod-campus-081616", "version": "0.0.0", "license": "MIT", "angular-cli": {}, "scripts": { "mongoService": "../Mongo/bin/mongod", "StartElasticSearch": "/usr/local/bin/elasticsearch", "StartKibana453": "/usr/local/kibana/bin/kibana", "node-start": "node ./bin/www", "angular-start": "ng serve --live-reload false", "postinstall": "typings install", "lint": "tslint \"src/**/*.ts\"", "test": "ng test", "pree2e": "webdriver-manager update", "e2e": "protractor" }, "private": true, "dependencies": { "@angular/common": "^2.0.0-rc.5", "@angular/compiler": "^2.0.0-rc.5", "@angular/core": "^2.0.0-rc.5", "@angular/forms": "0.3.0", "@angular/http": "2.0.0-rc.5", "@angular/platform-browser": "^2.0.0-rc.5", "@angular/platform-browser-dynamic": "^2.0.0-rc.5", "@angular/router": "3.0.0-rc.1", "angular2-oauth2": "^1.3.10", "aws-sdk": "^2.5.0", "aws-sign": "^0.1.2", "body-parser": "~1.15.1", "cookie-parser": "~1.4.3", "debug": "~2.2.0", "es6-shim": "0.35.1", "express": "~4.13.4", "fs": "0.0.2", "hbs": "~4.0.0", "jsonwebtoken": "^7.1.9", "moment": "^2.14.1", "mongoosastic": "^4.0.2", "mongoose": "^4.5.9", "mongoose-unique-validator": "^1.0.2", "morgan": "~1.7.0", "multer": "^1.2.0", "multer-s3": "^2.3.2", "ng2-bootstrap": "^1.0.24", "ng2-dropdown": "0.0.12", "ng2-file-upload": "^1.0.3", "password-hash": "^1.2.2", "path": "^0.12.7", "reflect-metadata": "0.1.3", "rxjs": "5.0.0-beta.6", "s3fs": "^2.4.8", "serve-favicon": "~2.3.0", "systemjs": "0.19.26", "uuid": "^2.0.2", "zone.js": "0.6.12" }, "devDependencies": { "angular-cli": "1.0.0-beta.10", "codelyzer": "0.0.20", "ember-cli-inject-live-reload": "1.4.0", "jasmine-core": "2.4.1", "jasmine-spec-reporter": "2.5.0", "karma": "0.13.22", "karma-chrome-launcher": "0.2.3", "karma-jasmine": "0.3.8", "protractor": "3.3.0", "ts-node": "0.5.5", "tslint": "3.11.0", "typescript": "1.8.10", "typings": "1.3.1" } } 

系统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 = { 'moment': 'vendor/moment/moment.js', 'angular2-oauth2': 'vendor/angular2-oauth2', 'aws-sdk': 'vendor/aws-sdk', 'aws-sign': 'vendor/aws-sign', 'fs': 'vendor/fs', 'ng2-bootstrap': 'vendor/ng2-bootstrap', 'ng2-file-upload': 'vendor/ng2-file-upload' }; /** User packages configuration. */ const packages: any = { 'angular2-oauth2': 'config.js', 'aws-sdk': 'index.js', 'aws-sign': 'index.js', 'ng2-bootstrap': 'ng2-bootstrap.js', 'ng2-file-upload': 'ng2-file-upload.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/header', 'app/article', 'app/auth', 'app/community', 'app/device', 'app/error', 'app/message', 'app/physical-drive', 'app/profile', 'app/topic', 'app/dashboard', 'app/profile/profile-edit', /** @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 }); 

简短的回答

如果碰到这个问题,并在另一个盒子上有一个工作版本的应用程序,请将node_modules文件夹从工作系统复制到出现问题的文件夹,删除dist文件夹的内容,然后重新启动应用程序。

很长的答案

到处search后,我认为这必须与已经在Angular2的RC版本(我开始使用Beta2开发这个应用程序)之间更新的软件包相关联,而且必须已经使用之前版本更新或删除的软件包。 基本上,似乎以前安装的东西不再是现在安装。

注意:

系统A一直在工作

系统B从未工作

我将我的整个node_modules文件夹从系统A复制到系统B。 重新启动的Node和Angular2,一切正常。 所以我从系统A中检查了这个node_modules文件夹与从系统B生成的文件夹进行比较,在删除node_modules文件夹后运行npm install

我注意到,自从我第一次安装它以来, 平台浏览器dynamic已经被严重的减less了。 (系统A上的120个项目与系统B上的66个项目)

我的package.json文件在系统A和B上用这一行标识:

“@ angular / platform-b​​rowser-dynamic”:“^ 2.0.0-rc.5”,

作为第一个testing,我将整个文件夹从A复制到B

结果:错误更改,不再抱怨平台浏览器dynamic,现在它说:

 Error loading http://localhost:4200/traceur Error loading http://localhost:4200/vendor/@angular/core/index.js as "@angular/core" 

我更换了Core,Compiler,Platform-b​​rowser和Common。

一旦所有这些文件夹已经被replace为我的其他系统的版本,一切都开始工作。

这是伟大的,但我必须说,这让我想知道我将如何能够部署这个应用程序。 我不知道我怎么能造成这种情况,(欢迎提供build议),所以我希望这是一个问题,最终版本的Angular2得到解决。