I'm using Angular 4 and want to use ngx-papaparse to parse some csv
I ran
yarn add -D ngx-papaparse@1.2.5
imported it in my app.module
import { PapaParseModule } from "ngx-papaparse";
imports: [
BrowserModule,
BrowserAnimationsModule,
FormsModule,
HttpClientModule,
PapaParseModule,
RouterModule.forRoot(AppRoutes),
],
and wrote the following code in my parser
import { Injectable } from "@angular/core";
import { PapaParseService } from "ngx-papaparse";
@Injectable()
export class ParserService {
constructor(private papa: PapaParseService) {
//
}
public getData(data) {
const options = {
complete: (results, file) => {
console.log("Parsed: ", results, file);
},
// Add your options here
};
this.papa.parse(data, options);
}
}
But I keep getting this issue at compilation
[!] Error: 'PapaParseService' is not exported by node_modules/ngx-papaparse/dist/index.js
The weird thing is that my Stackblitz app accepts ngx-papaparse@3.0.2 and doesn't run in this issue, whereas trying to install 3.0.2 gives me this:
Error: Metadata version mismatch for module /usr/local/apache2/htdocs/node_modules/ngx-papaparse/ngx-papaparse.d.ts, found version 4, expected 3