如何将yarn设置为Angular CLI的默认packageManager?我得到"无法阅读财产'价值' of null"

时间:2018-06-17 15:18:12

标签: angular angular-cli yarnpkg

当我运行以下命令时

ng set --global packageManager=yarn

我收到以下消息

"get/set have been deprecated in favor of the config command"

当我跑步时---

 ng config cli.packageManager yarn

我收到以下错误消息

Cannot read property 'value' of null
TypeError: Cannot read property 'value' of null
at ConfigCommand.set (C:\Users\Rahul\AppData\Roaming\npm\node_modules\@angular\cli\commands\config.js:207:36)
at ConfigCommand.run (C:\Users\Rahul\AppData\Roaming\npm\node_modules\@angular\cli\commands\config.js:181:18)
at C:\Users\Rahul\AppData\Roaming\npm\node_modules\@angular\cli\models\command-runner.js:278:30
at Generator.next (<anonymous>)
at fulfilled (C:\Users\Rahul\AppData\Roaming\npm\node_modules\@angular\cli\models\command-runner.js:4:58)
at <anonymous>

我该如何解决这个问题?

以下是版本信息 我使用的是Java 8。

NPM version - 5.6.0
Yarn version --1.7.0

ng - v给出了以下结果。我想使用Angular js

Angular CLI: 6.0.8
Node: 8.11.3
OS: win32 x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.6.8
@angular-devkit/core         0.6.8
@angular-devkit/schematics   0.6.8
@schematics/angular          0.6.8
@schematics/update           0.6.8
rxjs                         6.2.1
typescript                   2.7.2

1 个答案:

答案 0 :(得分:0)

如果要全局设置,请改用此设置:b.__rmul__(a) 如果您尝试在本地设置它,则可能会遇到问题,ng config -g cli.packageManager yarn会为您构建程序包,直到完成此操作,您才需要配置本地程序包。