[英]Can't upgrade to Angular4
Yes, I know that there are already thousands of similar questions - And no, none of the answers have worked for me. 是的,我知道已经有成千上万个类似的问题-不,没有答案对我有用。 I already had a problem with upgrading my Angular quite some while ago, and just decided to ignore the new updates. 很早以前,我已经在升级Angular时遇到了问题,只是决定忽略新的更新。
At first, I used the "standard" upgrade command: npm install @angular/common@latest @angular/compiler@latest @angular/compiler-cli@latest @angular/core@latest @angular/forms@latest @angular/http@latest @angular/platform-browser@latest @angular/platform-browser-dynamic@latest @angular/platform-server@latest @angular/router@latest @angular/animations@latest typescript@latest --save
That, however, resulted in the following error (+ Lots of warnings at the end): 最初,我使用了“标准”升级命令: npm install @angular/common@latest @angular/compiler@latest @angular/compiler-cli@latest @angular/core@latest @angular/forms@latest @angular/http@latest @angular/platform-browser@latest @angular/platform-browser-dynamic@latest @angular/platform-server@latest @angular/router@latest @angular/animations@latest typescript@latest --save
但是,导致以下错误(最后有很多警告):
+-- @angular/animations@4.1.3
+-- @angular/common@4.1.3
+-- UNMET PEER DEPENDENCY @angular/compiler@4.1.3
+-- @angular/compiler-cli@4.1.3 invalid
| +-- @angular/tsc-wrapped@4.1.3
| | `-- tsickle@0.21.6
| `-- reflect-metadata@0.1.10
+-- UNMET PEER DEPENDENCY @angular/core@4.1.3
+-- @angular/forms@4.1.3
+-- @angular/http@4.1.3
+-- @angular/platform-browser@4.1.3
+-- @angular/platform-browser-dynamic@4.1.3
+-- @angular/platform-server@4.1.3
| +-- parse5@3.0.2
| `-- xhr2@0.1.4
+-- @angular/router@4.1.3
+-- angular-cli@1.0.0-beta.24
| +-- @angular-cli/ast-tools@1.0.11
| | `-- typescript@2.0.10
| +-- UNMET PEER DEPENDENCY @angular/compiler@2.4.10
| +-- UNMET PEER DEPENDENCY @angular/compiler-cli@2.4.10
| | `-- @angular/tsc-wrapped@0.5.2
| +-- UNMET PEER DEPENDENCY @angular/core@2.4.10
| `-- typescript@2.0.10
+-- typescript@2.3.2 invalid
`-- UNMET PEER DEPENDENCY zone.js@0.7.4
Okay, no big deal, a quick google search told me (once again) to simply install each unmet peer dependency on its own. 好的,没什么大不了的,谷歌快速搜索告诉我(再次)只需自己安装每个未满足的对等依赖项。 The problem: Regardless which of the peer dependencies that aren't met I try to install, I get unmet peer dependencies errors. 问题:无论我尝试安装哪个未满足的对等依赖项,都会遇到未满足的对等依赖项错误。 Example: The first command told me that zone.js dependency isn't met. 示例:第一个命令告诉我不满足zone.js依赖关系。 So I quickly run npm install zone.js@0.7.4
, and get the error message with a few unmet dependencies, INCLUDING packages such as @angular/core for example, which, when I try to install them, tell me that amongst the unmet dependencies is zone.js. 因此,我快速运行npm install zone.js@0.7.4
,并得到带有一些未满足的依赖关系的错误消息,例如包含@ angular / core之类的软件包,当我尝试安装它们时,告诉我未满足的依赖项是zone.js。
Basically: The dependencies seem to depend on each other, and I'm not able to install any of them. 基本上:依赖性似乎相互依赖,并且我无法安装其中的任何一个。 My package.json got updated correctly, with all package versions shown as they should be, but I can not run my project, because the packages aren't installed. 我的package.json已正确更新,所有软件包的版本均应显示,但我无法运行我的项目,因为未安装软件包。
The only solution that I haven't tried yet is re-installing Angular completely - Which I'd like to avoid, if possible. 我还没有尝试过的唯一解决方案是完全重新安装Angular-如果可能的话,我想避免这种情况。
So, considering that anything regarding package.json doesn't work (Deleting, removing the versions, ...) and I can not install the dependencies that are shown as unmet, what exactly should I do to upgrade Angular properly? 因此,考虑到关于package.json的所有操作均不起作用(删除,删除版本等),并且我无法安装显示为未满足的依赖项,我应该怎么做才能正确升级Angular?
I've run into similar problems with what seems like circular package dependencies, so I feel your pain. 我在循环包装依赖方面也遇到了类似的问题,所以我感到您很痛苦。 I'd recommend giving yarn a try https://yarnpkg.com/en/ , it has helped me out a lot. 我建议尝试一下yarn https://yarnpkg.com/en/ ,它对我有很大帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.