别名已被“--collection”选项使用,不能被“--change-detection”选项使用

Joe*_*Joe 5 alias npm angular

环境:

  • Ubuntu 16.04
  • 角 CLI 1.7.3

我通过执行ng generate component dashboard得到错误,但它也发生在ng generate c

$ ng generate component dashboard
The "c" alias is already in use by the "--collection" option 
and cannot be used by the "--change-detection" option.
Please use a different alias.
Run Code Online (Sandbox Code Playgroud)

我试图在 npm 中查找错误,ant 我收到以下错误

$npm list
...
npm ERR! peer dep missing: @angular-devkit/core@0.4.5, required by @schematics/angular@0.4.5
npm ERR! peer dep missing: @angular-devkit/schematics@0.4.5, required by @schematics/angular@0.4.5
Run Code Online (Sandbox Code Playgroud)

它看起来与 npm 验证别名有关

函数 angular-cli.command.prototype.validateAlias(选项,别名)

但我不确定为什么要使用“c”而不是“component”。

Dav*_*ita 3

我不知道这个错误的根本原因,但是这个提交改变了很多别名(包括“组件”的“c”)...如果您在本地将其更改node_modules/@schematics/angular/component/schema.json为“cd”,ng generate则会再次工作。

请注意,在新项目中使用时ng g component test我不会重现此错误。我在产生错误的项目中使用@nrwl/nx。问题可能在于...我不知道是什么之间的版本不匹配。