0

I am getting the following error (Exhibit 1) when I run 'npm run dist' to build the ES2015 javascript bundles. There is no error when I run 'npm start -o'. The offending code seems to be from the Angular Material Autocomplete component (Exhibit 2) where I added a close button. When I remove the <button> then everything works. Exhibit 3 is the package.json for this app. Thank you.

Exhibit 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

Exhibit 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>

Exhibit 3:

  {
  "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"
  }
user266909
  • 1,841
  • 3
  • 32
  • 58

1 Answers1

0

I accidentally passed $event to the clearSearchTerm()

user266909
  • 1,841
  • 3
  • 32
  • 58