Skip to content

Conversation

beatrizsmerino
Copy link
Contributor

Checked the dependencies to be updated with the npm outdated command:
image

Checked the dependencies to be updated with the ncu command:
image

Updated dependencies from the project, except these:
image

Steps:
- Use the `ncu` command (`npm-check-updates`) to check the version of the packages to update:
Checking fusionauth-quickstart-javascript-angular-web/complete-application/package.json
[====================] 23/23 100%
 karma                               ~6.4.0  →   ~6.4.2
 karma-chrome-launcher               ~3.1.0  →   ~3.2.0
 karma-coverage                      ~2.2.0  →   ~2.2.1
 karma-jasmine-html-reporter         ~2.0.0  →   ~2.1.0
 rxjs                                ~7.5.0  →   ~7.8.1
 tslib                               ^2.3.0  →   ^2.6.2

References:
- https://www.npmjs.com/package/npm-check-updates
- #4
Steps:
- Use the `ng update @angular/cli@^16 @angular/core@^16` command to update from one major version to another.

References:
- https://angular.io/cli/update
- #4
Steps:
- Use the `ncu` command (`npm-check-updates`) to check the version of the packages to update:
Checking fusionauth-quickstart-javascript-angular-web/complete-application/package.json
[====================] 23/23 100%
 typescript       ~5.1.6  →   ~5.2.2

References:
- https://www.npmjs.com/package/npm-check-updates
- #4
Error:
- Found errors in the terminal when run the `npm install`
npm ERR! Could not resolve dependency:
npm ERR! peer typescript@">=4.9.3 <5.2" from @angular-devkit/build-angular@16.2.5

Reason:
- The `ERESOLVE` error from npm is indicating that there is a conflict with the project dependencies. The main problem here seems to be a conflict between the version of `typescript` you have installed and what `@angular-devkit/build-angular` expects.
In short, `@angular-devkit/build-angular@16.2.5` expects a `typescript` version between `>=4.9.3` and `<5.2`, but you currently have `5.2.2` version of `typescript` installed.

Solution:
- Downgrade TypeScript to 5.1.6 instead use 5.2.2

Other possible solutions:
- I would recommend trying these solutions in the order they are presented, as the first option is the safest. The option to use `--legacy-peer-deps` should be your last resort, as it may lead to unexpected problems later on.
1. **Downgrade TypeScript**:
If you don't have a specific reason for using TypeScript 5.2.2, you can downgrade to resolve the conflict:
````bash
npm install typescript@5.1.6 --save-dev
```
This will install ``5.1.6` version of TypeScript, which is compatible with `@angular-devkit/build-angular@16.2.5`.
2. **Use Flag `--legacy-peer-deps`**:
If you do not want to change the version of TypeScript and are willing to risk incompatibilities, you can use the `--legacy-peer-deps` flag:
````bash
npm install --legacy-peer-deps
```
However, be careful when doing this. While it may resolve the error and allow you to install the dependencies, you could face runtime problems due to incompatibilities.
3. **Update `@angular-devkit/build-angular`** (if a newer version is available):
There may be a newer version of `@angular-devkit/build-angular` that is compatible with TypeScript 5.2.2. You can try upgrading:
````bash
npm install @angular-devkit/build-angular@latest --save-dev
```
Then, check if the problem is solved.
4. **Check your `peerDependencies`**:
If the project was cloned from a repository or is a previous project, it is possible that the `peerDependencies` in your `package.json` are causing the conflict. In that case, check and adjust the versions in the `package.json` to make sure they are compatible.

References:
- #4
- This reverts commit 9e6f851.
@alex-fusionauth alex-fusionauth merged commit 105f8f7 into FusionAuth:main Oct 11, 2023
@alex-fusionauth
Copy link
Contributor

Tested and looks great!

@beatrizsmerino
Copy link
Contributor Author

Tested and looks great!

Thank you very much. I enjoyed it, if you have another assignment let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants