Angular 10 npm错误hasBindingPropertyName不是函数

问题描述

我在Jenkins构建中突然收到此错误,我尝试升级到最新的Angular,即10.1,但即使升级问题没有解决。所以我回滚到下面的Angular 10.0,package.json依赖项

[09/11/2020 03:26:56.420]-构建::编译 @ angular / platform-b​​rowser-dynamic / testing:es2015作为esm2015 [09/11/2020 03:27:09.120]-内部版本::错误:工作人员5上的错误: TypeError:dir [ioType] .hasBindingPropertyName不是函数 [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]-生成::位于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"
  }

解决方法

@ angular / compiler 10.1.1中似乎有一个问题。

这不是解决该问题的方法,但是我能够通过将@ angular / compiler和@ angular / compile-cli降级到10.0来解决此问题。仅对package.json进行更新是不够的。我还需要清理node_modules才能还原代码。

我采取的步骤导致构建成功...

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

注意上面的波浪号(〜)而不是脱字号(^),这样npm不会自动给您10.1.1。

  1. rm -rf node_modules

  2. npm update && ng build --prod

,

有时它是由于 HTML 中的结束标记过多或较少而发生的。 检查您在 html 模板文件中的最新更改。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...