1

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.

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):

+-- @angular/[email protected] +-- @angular/[email protected] +-- UNMET PEER DEPENDENCY @angular/[email protected] +-- @angular/[email protected] invalid | +-- @angular/[email protected] | | `-- [email protected] | `-- [email protected] +-- UNMET PEER DEPENDENCY @angular/[email protected] +-- @angular/[email protected] +-- @angular/[email protected] +-- @angular/[email protected] +-- @angular/[email protected] +-- @angular/[email protected] | +-- [email protected] | `-- [email protected] +-- @angular/[email protected] +-- [email protected] | +-- @angular-cli/[email protected] | | `-- [email protected] | +-- UNMET PEER DEPENDENCY @angular/[email protected] | +-- UNMET PEER DEPENDENCY @angular/[email protected] | | `-- @angular/[email protected] | +-- UNMET PEER DEPENDENCY @angular/[email protected] | `-- [email protected] +-- [email protected] invalid `-- UNMET PEER DEPENDENCY [email protected] 

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. So I quickly run npm install [email protected], 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.

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.

The only solution that I haven't tried yet is re-installing Angular completely - Which I'd like to avoid, if possible.

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?

1 Answer 1

2

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.

  1. Install yarn https://yarnpkg.com/en/docs/install
  2. Delete the node_modules folder in your project
  3. In the same folder with your package.json run 'yarn'. This will install all the old versions of your packages, including Angular 2.
  4. Then run 'yarn upgrade'. This should install the newest version of all of the packages, including Angular 4, with the correct dependencies.
Sign up to request clarification or add additional context in comments.

4 Comments

Thank you so much for your answer. I'm going to try this out right now, and I'll comment back here!
Weird, I tried doing that, and then I got some error that I have to be in the angular-cli. I then updated my devDependencies with a command I found online, then got told that my environmentSource entry wasn't found. Fixed that, and now I'm getting the error that my AppModule isn't an NgModule and some complicated stuff afterwards. What do you think should I do?
Nevermind, I got it to work by removing and reinstalling the node_modules!
Glad I could help!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.