简体   繁体   English

您的全局 Angular CLI 版本 (10.2.0) 高于您的本地版本 (10.0.8)。 使用本地 Angular CLI 版本

[英]Your global Angular CLI version (10.2.0) is greater than your local version (10.0.8). The local Angular CLI version is used

Your global Angular CLI version (10.2.0) is greater than your local version (10.0.8).您的全局 Angular CLI 版本 (10.2.0) 高于您的本地版本 (10.0.8)。 The local Angular CLI version is used.使用本地 Angular CLI 版本。 To disable this warning use "ng config -g cli.warnings.versionMismatch false".要禁用此警告,请使用“ng config -g cli.warnings.versionMismatch false”。


I don't know what to do with this.我不知道该怎么办。

I tried uninstalling angular/cli and npm cache clean but still have problems.我尝试卸载 angular/cli 和 npm cache clean 但仍然有问题。

It just means that you have installed the Angular CLI globally and locally (once using npm install -g and once using just npm install . That your project would use the locally installed version makes sense to me, since in all other cases it would presumably use the globally installed version.这只是意味着您已经在全局本地安装了 Angular CLI(一次使用npm install -g一次使用npm install 。您的项目将使用本地安装的版本对我来说很有意义,因为在所有其他情况下它可能会使用全局安装的版本。

But unless specific (and unusual) requirements require it, the CLI isn't really something that will change depending on the project.但是除非特定的(和不寻常的)需求需要它,否则 CLI 并不是真的会根据项目而改变。 So I'd keep only the globally installed version and uninstall the locally installed one.所以我只保留全局安装的版本并卸载本地安装的版本。 (I'm doubtful the ng command would even work if the CLI installed only locally, but I might be wrong about that.) (如果 CLI 仅在本地安装,我怀疑ng命令甚至可以工作,但我可能错了。)

If others work on the project and require the CLI, add an entry to your Readme instructing them to install the Angular CLI globally.如果其他人在该项目上工作并需要 CLI,请在自述文件中添加一个条目,指示他们全局安装 Angular CLI。 If, however, you require that everyone use the same CLI version, and a local installation of the CLI does enable the ng command, then you can also only keep the local one and uninstall the global one.但是,如果您要求每个人都使用相同的 CLI 版本,并且本地安装的 CLI 确实启用了ng命令,那么您也可以只保留本地的并卸载全局的。 Either way, you won't need both.无论哪种方式,您都不需要两者。 It just depends on your specific circumstances which way to go.这只是取决于你的具体情况,走哪条路。

Many people avoid to install npm globally.许多人避免全局安装 npm。 You can uninstall angular cli from globally您可以从全局卸载 angular cli

  • npm uninstall -g @angular/cli npm uninstall -g @angular/cli

Then you can ng command dont work, But dont panic.然后你可以 ng 命令不起作用,但不要惊慌。

You can do the same thing by:你可以通过以下方式做同样的事情:

  • npm run ng -- serve npm run ng -- 服务
  • npm run ng -- build npm run ng -- 构建

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在版本 9 上安装 @angular/cli 但随后报告版本 7 - Installing @angular/cli at version 9 but then reporting version 7 的@角/编译-CLI需要版本为2.3.1或更高。 当前版本为“未定义” - Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is “undefined” 此版本的CLI仅与Angular 5.0.0或更高版本错误兼容 - This version of CLI is only compatible with Angular version 5.0.0 or higher error 如何使用 angular cli 升级 angular 的次要版本 - How to upgrade minor version of angular using angular cli 此版本的 CLI 仅与 Angular 版本 ^13.0.0 || 兼容 ^13.3.0-rc.0,但找到的是 Angular 版本 14.2.12 - This version of CLI is only compatible with Angular versions ^13.0.0 || ^13.3.0-rc.0, but Angular version 14.2.12 was found instead Angular CLI(ng --version)命令错误TS和WebPack - Angular CLI (ng --version) command Error TS and WebPack 告诉您浏览器的Javascript版本 - To tell Javascript version of your browser 使用angular / cli版本1.0.0-beta.28.3时出现非常奇怪的错误 - Getting very weird error while using angular/cli version 1.0.0-beta.28.3 还原为旧版本的Ionic 2 CLI - Revert to an older version of Ionic 2 CLI Angular应用程序转移到版本6错误:“未定义全局” - Angular app transfer to version 6 error: 'Global is not defined'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM