简体   繁体   English

Angular2无法更新到RC7-zone.js和reflect-metadata

[英]Angular2 Failing to update to RC7 - zone.js & reflect-metadata

I'm trying to get my application to run with the new RC7 of angular but i cant seem to be able to get it done, as the console shouts: 我正在尝试让我的应用程序与新的angular7 RC7一起运行,但由于控制台喊叫声,我似乎无法完成它:

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

And when this somehow disappears, this pops up: 而当这种莫名其妙消失,这会弹出:

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

Looks like the implementation changed, and mine isn't updated although i npm install ed everything from scratch, update my package.json as follows: 看起来实现方式已更改,尽管我的npm install从头开始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: (I have also tried refering to unpkg.com for the packages, no success) 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>

Any idea how to fix this? 任何想法如何解决这个问题?

Thanks in advance! 提前致谢! :) :)

NOTEs : 注意事项

  • As per package.json, you are using Angular2.0.0 You don't need angular2-polyfills.js 根据package.json,您正在使用Angular2.0.0。您不需要angular2-polyfills.js
  • Remove "angular2": "2.0.0-beta.17" , from package.json package.json中删除“ angular2”:“ 2.0.0-beta.17”
  • Remove angular2-polyfills.js from index.html index.html删除angular2-polyfills.js

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

Infact, if you have angular2 folder under node_modules then delete that folder. 逸岸,如果你有下node_modules angular2文件夹,然后删除该文件夹。 latest angular2 packages will be available in @angular folder under node_modules . 最新的angular2软件包将在node_modules下的@angular文件夹中提供

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM