2016-09-17 53 views
1

我试图让我的应用程序运行与新的RC7的角度,但我似乎无法完成,作为控制台喊:Angular2未能更新到RC7 - zone.js和反射元数据

Promise rejection: Zone.assertZonePatched is not a function  angular2-polyfills.js:489 

当这个莫名其妙消失,这会弹出:

Reflect.getMetadata is not a function (..)        core.umd.js:472 

貌似实现改变,而我不更新,虽然我npm install来回编一切米从无到有,更新我的package.json如下:

{ 
    "name": "angular2-quickstart", 
    "version": "1.0.0", 
    "scripts": { 
    "build": "webpack", 
    "start": "webpack-dev-server", 
    "typings": "typings", 
    "postinstall": "typings install" 
    }, 
    "license": "ISC", 
    "dependencies": { 
    "@angular/common": "2.0.0-rc.7", 
    "@angular/compiler": "2.0.0-rc.7", 
    "@angular/core": "2.0.0-rc.7", 
    "@angular/forms": "2.0.0-rc.7", 
    "@angular/http": "2.0.0-rc.7", 
    "@angular/platform-browser": "2.0.0-rc.7", 
    "@angular/platform-browser-dynamic": "2.0.0-rc.7", 
    "@angular/router": "3.0.0-rc.3", 
    "@angular/upgrade": "2.0.0-rc.7", 
    "core-js": "^2.4.1", 
    "reflect-metadata": "^0.1.3", 
    "rxjs": "5.0.0-beta.12", 
    "zone.js": "^0.6.21", 
    "angular2-in-memory-web-api": "0.0.19", 
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.3", 
    "angular2": "2.0.0-beta.17", 
    "angular2-apollo": "^0.4.6", 
    "apollo-client": "^0.4.13", 
    "es6-promise": "^3.0.2", 
    "es6-shim": "^0.35.1", 
    "moment": "^2.14.1", 
    "source-map-loader": "^0.1.5" 
    }, 
    "devDependencies": { 
    "ts-loader": "^0.8.2" 
    } 
} 

index.html的:(我也试过指的unpkg.com的包,没有成功)

<html> 

    <head> 
    <title>My App</title> 

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.3/css/bootstrap.min.css" 
      integrity="sha384-MIwDKRSSImVFAZCVLtU0LMDdON6KVCrZHyVQQj6e8wIEJkW4tvwqXrbMIya1vriY" crossorigin="anonymous"> 
    <link rel="stylesheet" href="style.css"> 

    <!-- 1. Load libraries --> 
    <!-- IE required polyfills, in this exact order --> 
    <script src="node_modules/es6-shim/es6-shim.min.js"></script> 

    <script src="https://www.atlasestateagents.co.uk/javascript/tether.min.js"></script> 
    <script src="https://code.jquery.com/jquery-3.1.0.min.js"></script> 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.3/js/bootstrap.min.js" 
      integrity="sha384-ux8v3A6CPtOTqOzMKiuo3d/DomGaaClxFYdCu2HPMBEkf6x2xiDyJ7gkXU0MWwaD" crossorigin="anonymous"></script> 

    <script src="node_modules/core-js/client/shim.min.js"></script> 
    <script src="node_modules/zone.js/dist/zone.js"></script> 
    <script src="node_modules/reflect-metadata/Reflect.js"></script> 
    </head> 

    <!-- 3. Display the application --> 
    <body> 
    <my-app>Loading...</my-app> 
    </body> 

    <script src="node_modules/angular2/bundles/angular2-polyfills.js"></script> 
    <script src="dist/bundle.js"></script> 
</html> 

任何想法如何解决这一问题?

在此先感谢! :)

+0

您的'package.json'属于'Angular2.0'版本。 – micronyks

+0

@micronyks你是什么意思? –

+0

您正在安装Angular2.0(最近发布的软件包)如果您正在寻找RC7软件包,请参阅http://stackoverflow.com/questions/39496055/which-angular-forms-version-for-angular-2- rc7/39496132#39496132在那里我已经显示RC5包与systemjs不是webpack。 – micronyks

回答

2

票据

  • 按的package.json,你正在使用Angular2.0.0你不需要angular2-polyfills.js
  • 删除“angular2”:“2.0.0-beta.17”,from 的package.json
  • 的index.html删除angular2-polyfills.js

    <script src="node_modules/angular2/bundles/angular2-polyfills.js"></script> 
    

逸岸,如果你有angular2文件夹下node_modules然后删除该文件夹。最新的angular2软件包将可用于@angular文件夹下的node_modules

+0

你基本上说我应该删除依赖关系angular2从我的'包。json'只是重新'npm我'? (更新我的'package.json'依赖关系到-rc.7) –

+0

而angular2包似乎并不存在于node_modules下的@angular里: –

+0

清理node_modules文件夹,然后运行'npm install'它会在node_modules下为您提供@angular内的包。 – Sanket