角度构建错误

时间:2018-04-17 18:30:35

标签: angular npm

运行' npm run dist '我收到以下错误(图1)构建ES2015 javascript包。运行' npm start -o '时没有错误。违规代码似乎来自Angular Material Autocomplete组件(图表2),我在其中添加了一个关闭按钮。当我删除< button>一切正常。图表3是这个应用程序的package.json。谢谢。

图表1:



ERROR in src\app\shared\mat-autocomplete.html(9,69): : Expected 0 arguments, but
 got 1.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cli-app@0.0.0 build: `ng build --prod`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cli-app@0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\userName\AppData\Roaming\npm-cache\_logs\2018-04-16T16_5
8_56_375Z-debug.log




图表2:



<div class="flex-container">
  <mat-form-field>
    <span *ngIf="searching === true">
      <fa [name]="'spinner'" [size]="1" [spin]="true"></fa>
    </span>
    <input matInput [matAutocomplete]="auto" [formControl]="searchTerm" placeholder="Location Search: Enter at least 3 characters to trigger the search" aria-label="Search" type="text">
    <button mat-button matSuffix mat-icon-button aria-label="Clear" (click)="clearSearchTerm($event)" style="border:none; background:none; padding:1px">
      x
    </button>
    <mat-autocomplete #auto="matAutocomplete">
      <mat-option class="matOption" *ngFor="let item of searchResult" [value]="item.LocationName" (onSelectionChange)="optionChanged(item)">
        {{item.LocationName}}
      </mat-option>
    </mat-autocomplete>
    <div class="alert alert-warning" *ngIf="searchingSuccess === false">{{bindingMessage}}</div>
  </mat-form-field>
</div>
&#13;
&#13;
&#13;

图表3:

&#13;
&#13;
  {
  "name": "cli-app",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve -o",
    "build": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "deleteTarget": "del \"..\\..\\..\\AppPath\\NgApp\" /S /Q",
    "copy": "xcopy \"dist\" \"..\\..\\..\\AppPath\\NgApp\" /i /s /r /y /c",
    "dist": "npm run build && npm run deleteTarget && npm run copy"
  }
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

我不小心将$ event传递给clearSearchTerm()