I am currently working on upgrading my Angular 6 project to Angular 10, following the recommended approach of going through one major version at a time. Right now, I am in the process of updating it to version 7.3. Despite following the steps provided on update.angular.io, I feel that the guide might not be comprehensive enough. This query will be divided into multiple sub-queries:
- Upon upgrading the Angular Core and CLI (ng update @angular/cli@7 @angular/core@7), I encountered compile errors when trying to run "ng serve". Here are the error messages:
ERROR in node_modules/@angular/core/src/di/injector.d.ts(68,70): error TS1005: ',' expected. node_modules/@angular/core/src/render3/definition.d.ts(317,32): error TS1005: ')' expected. ... (node_modules errors continue) ... node_modules/@angular/core/src/render3/definition.d.ts(406,4): error TS1128: Declaration or statement expected.
It seems odd to encounter compile errors within the Angular Core code. Despite searching online for solutions, I haven't found any. I attempted deleting the contents of the node_modules folder and running "npm install" without success.
An unusual observation is that my current Typescript version is 2.7.2, which I believe should be higher for Angular 7. Therefore, I upgraded Typescript to 3.2 only to receive this error upon running "ng serve":
ERROR in The Angular Compiler requires TypeScript >=2.7.2 and <2.8.0 but 3.2.4 was found instead.
Consequently, I reverted back to Typescript 2.7.2.
Executing "ng update @angular/cli@7 @angular/core@7" resulted in several warnings:
(multiple npm WARNs displayed)
Should I be concerned about these warnings? Do I need to individually research each warning to determine the compatibility with Angular 7 and proceed with updates?
Here's an excerpt from my package.json file. It strikes me as peculiar that the instruction to update Angular Core and CLI did not automatically update other Angular dependencies.
{ "name": "Whatever",
...
(more content)
...
} }
Any suggestions on resolving the compile errors would be greatly appreciated! (Note: I do not utilize Angular Material)
- During the initial attempts to upgrade the Core and CLI (ng update @angular/cli@7 @angular/core@7), I kept encountering similar errors:
Package "ngx-carousel" has an incompatible peer dependency to "@angular/core" (requires ">=5.0.0-rc.0 <6.0.0||>=2.4.0 <3.0.0||>=4.0.0 <5.0.0", suggested "7.2.16"). Incompatible peer dependencies detected.
To address this, I updated the dependencies to later versions compatible with Angular 7. Why does the guidance on update.angular.io not mention updating dependencies? Is there an automated method to ensure all dependencies align with Angular 7?
In my exploration of various sources for Angular upgrades, conflicting advice abounds. One command in particular caught my attention:
ng update @angular/cli @angular/core
The addition of --all=true flag purportedly updates all packages listed in package.json. Would it be prudent to include this step? If so, why isn't it part of the primary Angular documentation? Will this action update beyond Angular 7?
Some experts advocate for executing the following command:
ng update --all --force
Is this advisable?
- Upon researching the process of upgrading from Angular 6 to 7, I stumbled upon diverse sets of instructions. Two examples are:
https://medium.com/@jeroenouw/upgrade-to-angular-7-beta-within-10-minutes-c14fc380edd
These guides contain additional commands like:
npm install @angular/animations@latest @angular/common@latest @angular/compiler@latest @angular/core@latest @angular/forms@latest @angular/http@latest @angular/platform-browser@latest @angular/platform-browser-dynamic@latest @angular/router@latest --save
Is this approach recommended if the goal is to advance to Angular 7 rather than the latest version?
After installing a package using npm, the following message appeared:
found 1321 vulnerabilities (947 low, 20 moderate, 352 high, 2 critical) run
npm audit fix
to fix them, ornpm audit
for details
Would it be wise to execute "npm audit fix"? Are there potential drawbacks, such as breaking existing code?
Your insights and recommendations on addressing these challenges would be highly valued!