根据 npm ,截至本文撰写时@angular/cli
的最新版本为v6.2.5
。
运行ng -v
时,我得到
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 1.6.0
Node: 8.11.3
OS: win32 x64
Angular: 6.1.10
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router
@angular/cli: 1.6.0
@angular/language-service: 5.2.11
@angular-devkit/architect: 0.8.5
@angular-devkit/build-angular: 0.8.5
@angular-devkit/build-optimizer: 0.0.35
@angular-devkit/build-webpack: 0.8.5
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.41
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 6.2.5
typescript: 2.7.2
webpack: 4.21.0
所以我尝试升级,执行这些命令
npm uninstall -g @angular/cli
npm cache verify
npm install -g @angular/cli@latest
但是,当我再次运行 ng -v
时,仍然获得与上面相同的输出!
ng
不能按预期升级吗?
答案 0 :(得分:0)
@angular/cli的Github存储库为nodejs引擎之类的文件定义了package.json
"engines": {
"node": ">=10.9.0 <11.0.0",
"yarn": ">=1.9.0 <2.0.0"
}
因此,请尝试安装节点> = 10.9和<11.0再试一次。