sweetalert2 / ngx-sweetalert2

Declarative, reactive, and template-driven SweetAlert2 integration for Angular
MIT License
652 stars 94 forks source link

Error during installation in Angular 17 #261

Closed luanpaivadev closed 7 months ago

luanpaivadev commented 8 months ago

When trying to install the project using Angular 17, this error is occurring:

npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: control-vendas-app@0.0.0 npm ERR! Found: @angular/common@17.0.9 npm ERR! node_modules/@angular/common npm ERR! @angular/common@"^17.0.0" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer @angular/common@"^14.0.0 || ^15.0.0 || ^16.0.0" from @sweetalert2/ngx-sweetalert2@12.2.0 npm ERR! node_modules/@sweetalert2/ngx-sweetalert2 npm ERR! @sweetalert2/ngx-sweetalert2@"*" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Is there already a solution?

danieljames08 commented 8 months ago

Hi luanpaivadev!

Yes, there is a solution. The reason you are facing this issue is because this project is built using angular/core@16 but your angular/core version is 17.0

you can resolve this issue by downgrading your angular version to angular/cli@16 and do "ng update @angular/cli @angular/core" then try to start the server "ng serve"

If your still facing issues, try to delete the node modules and run "npm install --legacy-peer-deps"

-- This would fix the issue... !!!

Your welcome to revert me back !!!

Happy coding !

luanpaivadev commented 8 months ago

@danieljames08

Downgrading is not an option, I am using features that only exist in version 17 of Angular. :'(

10-ti commented 7 months ago

npm install ... --legacy-peer-deps

Lucasrsv1 commented 7 months ago

Until the PR #252 is merged, we can workaround this error by adding the following override to package.json:

"overrides": {
    "@sweetalert2/ngx-sweetalert2": {
        "@angular/common": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0",
        "@angular/core": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
    }
}

I hope this helps.

limonte commented 7 months ago

:tada: This issue is solved in version 12.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: