node.js 您的全局 Angular CLI 版本 (6.0.8) 高于您的本地版本 (1.0.2)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/50831686/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Your global Angular CLI version (6.0.8) is greater than your local version (1.0.2)
提问by v8-E
C:\dev\myApp> ng serve -o
Your global Angular CLI version (6.0.8) is greater than your local version (1.0.2).
The local Angular CLI version is used.
To disable this warning use `"ng config -g cli.warnings.versionMismatch false"`
I don't know what to do with this.
我不知道该怎么办。
I tried uninstalling angular/cli and npm cache cleanbut still have problems.
我尝试卸载 angular/cli 和 npm cache clean但仍然有问题。
Anyone help me !
任何人都可以帮助我!
回答by Poul Kruijt
You have the old angular/cli package in your package.json
你的 package.json 中有旧的 angular/cli 包
To update use:
要更新使用:
npm r angular-cli
npm i @angular/cli@latest -D
Be aware though, if you have already been using the old cli for a long time, you might have to do some code migration. Especially when it comes to tests, polyfills and the angular config file.
但是请注意,如果您已经长时间使用旧的 cli,您可能需要进行一些代码迁移。尤其是在测试、polyfills 和 angular 配置文件方面。
You could try to create an empty angular project using the new cli, and compare the files which are created there, with the files you have in your own project, and update where applicable.
您可以尝试使用新的 cli 创建一个空的 angular 项目,并将在那里创建的文件与您自己项目中的文件进行比较,并在适用的情况下进行更新。
After that, when you have to update your cli again, you can use the new ng updatecommand
之后,当您必须再次更新 cli 时,您可以使用新ng update命令
回答by v8-E
You are using new project in older CLI you need to run this commands
您在旧的 CLI 中使用新项目,您需要运行此命令
npm uninstall --save-dev angular-cli
npm install --save-dev @angular/cli@latest
npm install
or you can try this approach
或者你可以试试这个方法
Updating npm :
更新 npm :
Run [sudo] npm install -g npm (sudo is only required on Mac/ Linux)
Updating the CLI :
更新 CLI:
[sudo] npm uninstall -g angular-cli @angular/cli
npm cache clean
[sudo] npm install -g @angular/cli
回答by Anjasmara Dwi.S
i have try all command above but, it don't work. Maybe you can try this command for same probblem. it work for me.
我已经尝试了上面的所有命令,但它不起作用。也许您可以针对相同的问题尝试使用此命令。它对我有用。
ng update @angular/cli @angular/core
npm uninstall --save-dev angular-cli
npm install
if it still problem you can visit : https://angular.io/cli/updateand you can choice "Angular Update Guide" for specify version update from X to X
如果仍然有问题,您可以访问:https: //angular.io/cli/update并且您可以选择“Angular Update Guide”来指定从 X 到 X 的版本更新

