为什么安装版本 7 后 Angular CLI 版本显示为 1? [英] Why does Angular CLI version say 1 after installing version 7?
本文介绍了为什么安装版本 7 后 Angular CLI 版本显示为 1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将我的 Angular CLI 全球版本更新到最新版本.
I'm attempting to update my global version of Angular CLI to the latest version.
为什么ng v
安装后仍然不显示1.3.2版本?
Why doesn't ng v
still show version 1.3.2 after installing?
顺便说一句,我正在使用 nvm
.
I'm using nvm
btw.
安装前...
$ng -v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
@angular/cli: 1.3.2
node: 10.14.1
os: darwin x64
正在安装...
npm uninstall -g angular-cli
npm cache verify
npm install -g @angular/cli@latest
/Users/U6020643/.nvm/versions/node/v10.14.1/bin/ng -> /Users/U6020643/.nvm/versions/node/v10.14.1/lib/node_modules/@angular/cli/bin/ng
> fsevents@1.2.4 install /home/.nvm/versions/node/v10.14.1/lib/node_modules/@angular/cli/node_modules/fsevents
> node install
[fsevents] Success: "/home/.nvm/versions/node/v10.14.1/lib/node_modules/@angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
+ @angular/cli@7.1.1
安装后....
$ ng -v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
@angular/cli: 1.3.2 <-- why isn't this 7.1.1?
node: 10.14.1
os: darwin x64
推荐答案
好吧,我似乎已经解决了这个问题.我再次使用 OS X (Sierra),通过 nvm
安装 Node.归功于 无法为潜在客户卸载 angular-cli.
Alright so this is how I appear to have fixed this issue. Again I'm on OS X (Sierra), with Node installed via nvm
. Credit to Cannot uninstall angular-cli for a lead.
找到 Angular CLI 安装
Locate Angular CLI install
which ng
/<home>/.nvm/versions/node/v10.14.1/bin/ng
NVM 托管版本已链接
NVM managed version is linked
ls -l /<home>/.nvm/versions/node/v10.14.1/bin/ng
lrwxr-xr-x 1 <user> staff 39 Dec 3 20:25 /<home>/.nvm/versions/node/v10.14.1/bin/ng -> ../lib/node_modules/@angular/cli/bin/ng
删除
rm -rf /<home>/.nvm/versions/node/v10.14.1/bin/ng
rm -rf ../lib/node_modules/@angular/cli/bin/ng
检查(等待另一个安装)
which ng
/usr/local/bin/ng
删除最后一个
rm -rf /usr/local/bin/ng
which ng
<blank>
现在重新安装ng
npm install -g @angular/cli@latest
ng
-bash: ng: command not found
使用nvm
nvm use 8 # This just happens to be another version I had installed
切换回有问题的版本
nvm use 10
Now using node v10.14.1 (npm v6.4.1)
瞧
ng v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 7.1.1
Node: 10.14.1
OS: darwin x64
Angular:
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.11.1
@angular-devkit/core 7.1.1
@angular-devkit/schematics 7.1.1
@schematics/angular 7.1.1
@schematics/update 0.11.1
rxjs 6.3.3
typescript 3.1.6
这篇关于为什么安装版本 7 后 Angular CLI 版本显示为 1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文