tofiqquadri / ngx-csv-parser

CSV Parser for Angular by Developers Hive
https://tofiqquadri.com/hire/connect
MIT License
25 stars 52 forks source link

Angular 11 support #31

Closed Mac-prof closed 1 year ago

Mac-prof commented 1 year ago

after installing v1.2.0 I receive compilation errors. This actually happens regardless of he parser version I install - always receiving error in compilation since I use Angular 11.

└─┬ ngx-csv-parser@1.2.0 └── @angular/core@11.0.9 deduped invalid: "^14.1.3" from node_modules/ngx-csv-parser

└─┬ ngx-csv-parser@1.2.0 └── @angular/common@11.0.9 deduped invalid: "^14.1.3" from node_modules/ngx-csv-parser

tofiqquadri commented 1 year ago

Hey @Mac-prof, could you please share a sample project and the error that you are facing? Did you try downgrading the version of ngx-csv-parser?

Mac-prof commented 1 year ago

It is always - regardless of ngx-csv-parser version mismatch error with angular/core or angular/common version. Please find below error log when 0.0.7 version is installed and angular 11 is used. When using the latest ngx-csv-parser version I receive similar error but indicating that instead of angular 14 I use angular 11.

2022-11-16T08:16:21.223Z [WARNING]: ERESOLVE could not resolve
                                    npm ERR!
                                    npm ERR! While resolving: ngx-csv-parser@0.0.7
                                    npm ERR! Found: @angular/common@11.0.9
                                    npm ERR! node_modules/@angular/common
                                    npm ERR!   @angular/common@"^11.0.9" from the root project
                                    npm ERR!   peer @angular/common@"^11.0.0 || ^12.0.0-0" from @angular/cdk@11.2.13
                                    npm ERR!   node_modules/@angular/cdk
                                    npm ERR!     @angular/cdk@"^11.2.4" from the root project
                                    npm ERR!     peer @angular/cdk@"11.2.13" from @angular/material@11.2.13
                                    npm ERR!     node_modules/@angular/material
                                    npm ERR!       @angular/material@"^11.2.12" from the root project
                                    npm ERR!   5 more (@angular/forms, @angular/material, ...)
                                    npm ERR!
                                    npm ERR! Could not resolve dependency:
                                    npm
2022-11-16T08:16:21.223Z [WARNING]: ERR! peer @angular/common@"^8.1.3" from ngx-csv-parser@0.0.7
                                    npm ERR! node_modules/ngx-csv-parser
                                    npm ERR!   ngx-csv-parser@"^0.0.7" from the root project
                                    npm ERR!
                                    npm ERR! Conflicting peer dependency: @angular/common@8.2.14
                                    npm ERR! node_modules/@angular/common
                                    npm ERR!   peer @angular/common@"^8.1.3" from ngx-csv-parser@0.0.7
                                    npm ERR!   node_modules/ngx-csv-parser
                                    npm ERR!     ngx-csv-parser@"^0.0.7" 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.
                                    npm ERR!
                                    npm ERR! See /root/.npm/eresolve-report.txt for a full report.
Mac-prof commented 1 year ago

I found a workaround which worked in my case (does not guarantee by any means it will in other cases). It is still a workaround though, so not a convenient solution.

Would you comment on how to have this working w/o a workaround?

for the 0.0.7 version of ngx-csv-parser component REPLACE in the package-lock.json file the following:

        "node_modules/ngx-csv-parser": {
            "version": "0.0.7",
...
            },
            "peerDependencies": {
                "@angular/common": "^8.1.3",
                "@angular/core": "^8.1.3"
            }

with this:

        "node_modules/ngx-csv-parser": {
            "version": "0.0.7",
...
            },
            "peerDependencies": {
                "@angular/common": "^11.0.9",
                "@angular/core": "^11.0.9"
            }