Search code examples
angulartypescriptpapaparse

Usage of Papaparse with Angular 2: Cannot find name 'Papa'


I am working on a project where I upload a csv file and parse it to view the results in a list. Everything worked fine untill I deleted my node_modules to re-install them to get rid other errors. When I did npm updated my node modules again the definition of 'Papa' can not be found again and I don't know how to let Angular 2 find the name 'Papa' so that my application works again.

I tried adding import {} from '../../papaparse.min.js' to reference to the location of the papaparse file but this didn't work.

Is there a certain module I need to add in my app.module again? I used the npm install papaparse command to install papaparse.


Solution

  • I would recommend using github.com/Alberthaff/ngx-papaparse, it makes it strait forward to work with PapaParse and Angular. For Angular 2 just install it with npm install [email protected] --save