未捕获的SyntaxError:意外的令牌导入;从Angular 2 RC5更新为Angular 2 Final后;

时间:2016-10-10 17:25:12

标签: angular visual-studio-2015

我已将我的应用程序从Angular 2 RC5更新为Angular 2 final。之后我收到错误未捕获的SyntaxError:意外的令牌导入;

我拥有最新版本的所有软件包,甚至将节点更新为6.7.0。我正在使用:

Visual Studio 2015 Update 3 Angular 2决赛 角度2材料 的WebPack

的package.json

{
  "name": "app",
  "version": "1.0.0",
  "description": "App development",
  "scripts": {
    "setup": "npm install",
    "build": "rimraf dist && webpack --config config/webpack.prod.js --progress --profile --bail",
    "postinstall": "typings install"
  },
  "dependencies": {
    "@angular/common": "^2.0.2",
    "@angular/compiler": "^2.0.2",
    "@angular/core": "^2.0.2",
    "@angular/forms": "^2.0.2",
    "@angular/http": "^2.0.2",
    "@angular/platform-browser": "^2.0.2",
    "@angular/platform-browser-dynamic": "^2.0.2",
    "@angular/router": "^3.0.2",
    "@angular2-material/button": "^2.0.0-alpha.8-2",
    "@angular2-material/card": "^2.0.0-alpha.8-2",
    "@angular2-material/core": "^2.0.0-alpha.8-2",
    "@angular2-material/icon": "^2.0.0-alpha.8-2",
    "@angular2-material/menu": "^2.0.0-alpha.8-2",
    "@angular2-material/toolbar": "^2.0.0-alpha.8-2",
    "core-js": "^2.4.1",
    "lodash": "^4.16.4",
    "reflect-metadata": "^0.1.8",
    "rxjs": "^5.0.0-beta.12",
    "zone.js": "^0.6.25"
  },
  "devDependencies": {
    "less": "^2.7.1",
    "css-loader": "^0.23.1",
    "extract-text-webpack-plugin": "^1.0.1",
    "file-loader": "^0.8.5",
    "html-loader": "^0.4.3",
    "html-webpack-plugin": "^2.20.0",
    "null-loader": "^0.1.1",
    "raw-loader": "^0.5.1",
    "rimraf": "^2.5.2",
    "style-loader": "^0.13.1",
    "ts-loader": "^0.8.2",
    "typescript": "^3.10.3",
    "typings": "^1.0.4",
    "webpack": "^1.13.1",
    "webpack-merge": "^0.14.0"
  },
  "repository": {
    "type": "git",
    "url": "https://optimint.visualstudio.com/defaultcollection/_git/HRP"
  },
  "author": "Deepak Dalal",
  "license": "ISC",
  "-vs-binding": {
    "AfterBuild": [],
    "ProjectOpened": [
      "setup"
    ]
  }
}

tsconfig

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true
  },
  "exclude": [
    "node_modules",
    "typings/main",
    "typings/main.d.ts"
  ]
}

分型

{
  "name": "app",
  "resolution": "app/Scripts/typings",
  "globalDependencies": {
    "core-js": "registry:dt/core-js#0.0.0+20160725163759",
    "hammerjs": "registry:dt/hammerjs#2.0.8+20160724063812",
    "jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
    "node": "registry:dt/node#6.0.0+20160909174046"
  }
}

提前致谢!!!

1 个答案:

答案 0 :(得分:0)

检查你的导入语句。他们应该是这样的,

<div class="col-md-8"  ng-controller="checklistController" ng-init='populateChecklist(<%=request.getParameter("id")%>)'>
           <div class="table-responsive">
              <table class="table table-bordered">
                <thead>
                  <tr>
                    <th>Checklist Name</th>
                    <th>Not Required</th>
                    <th>Completed</th>
                    <th>Link</th>
                  </tr>
                </thead>
                  <tbody>
                   <tr ng-repeat = "x in list">
                     <td>{{x.name}}</td>
                    <td><input type="checkbox" ng-model='notRequiredCheckList'  ng-disabled="completedCheckList" ng-disabled="linkForCheckList"/></td>
                    <td><input type="checkbox" ng-disabled="notRequiredCheckList" ng-model="completedCheckList" /></td>
                    <td><input type="text" ng-model="linkForCheckList" size="50" ng-disabled="notRequiredCheckList"/></td>
                   </tr>
                  </tbody>
              </table>
          </div>
             <button type"button" ng-click="savelist(list)">Send</input>
      <div>