【发布时间】:2017-05-23 19:30:08
【问题描述】:
我们正在开发一个应用程序,使用节点作为服务器/api,使用角度作为前端,目前我们在我的团队成员的一台机器上遇到了一个奇怪的问题。
我们是 3 个开发人员,其中 2 个使用 Windows 10,另一个使用 MacOS 10.12.5,当尝试在浏览器上加载客户端时出现以下问题:
zone.js:642 Unhandled Promise rejection: Template parse errors:
More than one component matched on this element.
Make sure that only one component's selector can match a given element.
Conflicting components: MdButton,MdButton ("<span>[ERROR ->]<button class="butron" md-button [mdMenuTriggerFor]="menu">{{menuItem}}</button>
<md-menu #menu="mdMe"): ng:///AppModule/MenuComponentComponent.html@0:6
More than one component matched on this element.
Make sure that only one component's selector can match a given element.
Conflicting components: MdMenuItem,MdMenuItem ("}}</button>
<md-menu #menu="mdMenu">
<a [routerLink]="['/participant']" routerLinkActive="active">[ERROR ->]<button md-menu-item>Participante</button></a>
<a [routerLink]="['/company']" routerLinkActive="act"): ng:///AppModule/MenuComponentComponent.html@2:63
More than one component matched on this element.
[...and so on]
开发环境如下:
- 节点 7.9.0
- npm 4.2.0
而前端的package.json是:
"dependencies": {
"@angular/animations": "^4.0.2",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/flex-layout": "^2.0.0-beta.8",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/material": "^2.0.0-beta.5",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"@covalent/core": "^1.0.0-beta.3-2",
"@covalent/dynamic-forms": "^1.0.0-beta.3-2",
"@covalent/highlight": "^1.0.0-beta.3-2",
"@covalent/http": "^1.0.0-beta.3-2",
"@covalent/markdown": "^1.0.0-beta.3-2",
"core-js": "^2.4.1",
"hammerjs": "^2.0.8",
"ngx-uploader": "^2.2.8",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "^1.0.0",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.2.0"
}
我们已经验证了我们三个都在相同版本的节点、npm、所有相同的包上,并且我们在同一个分支上进行了相同的提交,但是每当我们在 Mac 计算机上执行服务时,一切都正确加载节点控制台,但在尝试加载应用程序时出现上述错误,但在 Windows 环境中,我们无法重现该问题,因为一切正常且符合预期。
我们已经删除并克隆了项目并进行了几次npm安装,仅删除了node_modules文件夹并重新安装了它们,重新安装了node和npm,从全局包或本地包中调用了ng,依此类推,没有一个起作用到目前为止。
我已经进行了一些搜索,似乎某些人使用了早期版本的 angular 2,但其中大多数已通过更新包修复,并且由于我们 3 有相同的问题,我们认为这不是问题,有其他人面临类似的事情吗?在这一点上,我们几乎一无所知。
提前感谢您的帮助。
编辑:我必须补充一点,自从我将项目从 angular-cli beta 更新到稳定版本并将 angular 从 2.3.1 更新到 4.0.2 后,这种情况就开始发生了。
【问题讨论】:
标签: macos angular angular-cli