Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 10 npm error hasBindingPropertyName is not a function

Tags:

npm

angular10

I am getting this error all of sudden in Jenkins build, i tried upgrading to latest Angular that is 10.1 but even after upgrading issue is not resolved. So i rolled back to Angular 10.0, package.json dependencies below

[09/11/2020 03:26:56.420] - Build:: Compiling @angular/platform-browser-dynamic/testing : es2015 as esm2015 [09/11/2020 03:27:09.120] - Build:: Error: Error on worker #5: TypeError: dir[ioType].hasBindingPropertyName is not a function [09/11/2020 03:27:09.120] - Build:: at Project_folder/node_modules/@angular/compiler/bundles/compiler.umd.js:30061:79 [09/11/2020 03:27:09.120] - Build:: at Array.find () [09/11/2020 03:27:09.120] - Build:: at setAttributeBinding

Package.json

"dependencies": {
    "@angular-devkit/build-angular": "0.1000.4",
    "@angular/animations": "^10.0.7",
    "@angular/common": "^10.0.7",
    "@angular/compiler": "^10.0.7",
    "@angular/core": "^10.0.7",
    "@angular/forms": "^10.0.7",
    "@angular/platform-browser": "^10.0.7",
    "@angular/platform-browser-dynamic": "^10.0.7",
    "@angular/router": "^10.0.7",
    "@ng-idle/core": "^8.0.0-beta.4",
    "@ng-idle/keepalive": "^8.0.0-beta.4",
    "@nguniversal/express-engine": "^9.1.1",
    "@nguniversal/module-map-ngfactory-loader": "^8.1.1",
    "async-exit-hook": "^2.0.1",
    "body-parser": "^1.18.3",
    "cfenv": "^1.2.2",
    "classlist.js": "^1.1.20150312",
    "core-js": "^3.0.0",
    "crypto-js": "3.1.9-1",
    "d3": "^5.9.2",
    "dotenv": "^8.1.0",
    "eureka-js-client": "^4.4.2",
    "file-saver": "^2.0.1",
    "google-maps": "^4.3.2",
    "healthcheck-ping": "^2.0.1",
    "hystrixjs": "^0.2.0",
    "jsnlog": "^2.29.0",
    "json-logic-js": "^1.2.2",
    "jsrsasign": "^8.0.20",
    "memory-cache": "^0.2.0",
    "morgan": "^1.9.1",
    "ng2-cookies": "^1.0.12",
    "ng2-slimscroll": "^2.0.1",
    "ngx-ui-loader": "^9.1.1",
    "ngx-webstorage": "^5.0.0",
    "node-fetch": "^2.3.0",
    "preboot": "^7.0.0",
    "reflect-metadata": "^0.1.13",
    "source-map-support": "^0.5.11",
    "string-to-json": "^0.1.0",
    "text-mask-addons": "^3.8.0",
    "tslib": "^2.0.0",
    "web-animations-js": "^2.3.2",
    "weighted-round-robin": "^2.0.2",
    "zone.js": "~0.10.3"
  },
  "devDependencies": {
    "@angular/cli": "^10.0.4",
    "@angular/compiler-cli": "^10.0.7",
    "@angular/language-service": "^10.0.7",
    "@types/express": "^4.17.7",
    "@types/google-maps": "^3.2.2",
    "@types/jasmine": "^3.5.11",
    "@types/jasminewd2": "^2.0.6",
    "@types/node": "^14.0.23",
    "@types/node-fetch": "^2.5.5",
    "browserstack-local": "^1.3.7",
    "codelyzer": "^6.0.0",
    "cpx": "^1.5.0",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~3.3.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "ng-packagr": "^10.0.0",
    "npm-run-all": "^4.1.5",
    "protractor": "~7.0.0",
    "rimraf": "^3.0.0",
    "ts-loader": "^7.0.5",
    "ts-node": "^8.10.2",
    "tslint": "~6.1.0",
    "typescript": "3.9.7",
    "webpack-bundle-analyzer": "^3.1.0",
    "webpack-cli": "^3.3.12",
    "webpack-node-externals": "^1.7.2"
  }
like image 391
Pat Avatar asked Sep 11 '20 16:09

Pat


1 Answers

It seems there is an issue in @angular/compiler 10.1.1.

This isn't a solution for that problem, but I was able to workaround the issue by downgrading both @angular/compiler and @angular/compile-cli to 10.0. An update to package.json alone wasn't sufficient. I also needed to clean up node_modules to revert the code.

The steps I took that resulted in a successful build...

  1. Update package.json
 "dependencies": {
    ...
    "@angular/compiler": "~10.0.3",
    ...
  },
  "devDependencies": {
    ...
    "@angular/compiler-cli": "~10.0.3",
    ...
  }

Note the tilde (~) instead of caret (^) above so that npm doesn't automatically give you 10.1.1.

  1. rm -rf node_modules

  2. npm update && ng build --prod

like image 93
Jason Alpers Avatar answered Jan 04 '23 06:01

Jason Alpers