3

I used this link to upgrade my simple angular frontend to Angular 7:

Update to Angular 7

While updating i got several warnings for package.json and polyfills.ts files:

UPDATE package.json (1313 bytes)
npm WARN @ngtools/[email protected] requires a peer of typescript@~2.4.0 || ~2.5.0 || ~2.6.0 || ~2.7.0 || ~2.8.0 || ~2.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/compiler@>=2.3.1 <7.0.0 || >6.0.0-beta <7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@>=2.3.1 <7.0.0 || >6.0.0-beta <7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/platform-browser-dynamic@>=2.3.1 <7.0.0 || >6.0.0-beta <7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/platform-browser@>=2.3.1 <7.0.0 || >6.0.0-beta <7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/common@>=2.3.1 <7.0.0 || >6.0.0-beta <7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 69 packages, removed 4 packages, updated 16 packages and moved 2 packages in 43.395s
UPDATE package.json (1315 bytes)
UPDATE src/polyfills.ts (3165 bytes)
npm WARN [email protected] requires a peer of @angular/compiler@>=2.3.1 <7.0.0 || >6.0.0-beta <7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@>=2.3.1 <7.0.0 || >6.0.0-beta <7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/platform-browser-dynamic@>=2.3.1 <7.0.0 || >6.0.0-beta <7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/platform-browser@>=2.3.1 <7.0.0 || >6.0.0-beta <7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/common@>=2.3.1 <7.0.0 || >6.0.0-beta <7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

And I also have this error from typescript (3.0.1):

Error:Initialization error (angular 2 language service). Cannot read property 'CommandTypes' of undefined

Can anyone suggest a workaround how to fix these dependency warnings and typescript error? Do I need to change the dependencies manually? If yes I would need an example how to...

3
  • Angular actually has an official Update tool that you should be using. It makes the update process pretty straightforward and easy. Try Angular Update Commented Oct 24, 2018 at 8:03
  • Please tell the steps you went through, otherwise it's hard to know. Did you do ng update ? What does your packages.json look like? Commented Oct 24, 2018 at 8:10
  • I did the following ng command from my link: ng update @angular/cli @angular/core Commented Oct 24, 2018 at 8:30

2 Answers 2

2

The problem is you don't have the latest version for those two packages.

  1. You need to update your package Codelyzer to the latest version. ng update --all should do it, otherwise you can also edit your package.json by hand.

You can see here that the latest version (4.5.0) of this package has been made compatible with Angular 7, so you need to use it instead of your 4.2.1 version.

  1. Same thing for your @ngtools/webpack, you need to use the latest version (see here, it is 7.0.2). It is likely you don't have this one explicitly in your packages.json, so you may just need to do a npm cache clean -f before running ng update.

If this still doesn't work, I suggest you remove your node_modules directory, it will force npm install to rebuild all from the latest versions on the repository, given you correctly updated your package.json (by hand or through ng update).

Sign up to request clarification or add additional context in comments.

2 Comments

your solution for solving my dependency problems worked well :) I ran npm cache clean -f and afterwords ng update --all. Anyway I have still the typescript error: Error:Initialization error (angular 2 language service). Cannot read property 'CommandTypes' of undefined
Ok, mark as an answer then :) Update Typescript also. And it is another issue, you have to see from what code it is thrown, and it might be another question to ask on StackOverflow if you can't solve it.
0

Did you remove your old node_modules folder? if not please delete it and also delete package-lock.json if it's there. clean npm cache npm cache clean -f and try installing all the packages

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.