I try to use csvtojson
const csv = require("csvtojson");
const csvFilePath = require('./../../books.csv');
csv()
.fromFile(csvFilePath)
.then((jsonObj)=>{
console.log(jsonObj);
})
My file.csv is
Book,Author,Amount,Price
The Compound Effect,Darren Hardy,5,9.48
The 7 Habits of Highly Effective People,Stephen R. Covey,4,23.48
The Miracle Morning,Hal Elrod,10,21.34
Influence: The Psychology of Persuasion,Robert B. Cialdini,4,12.99
The ONE Thing,Gary Keller,1,11.18
And I have the next error
The Compound Effect,Darren Hardy,5,9.48
^^^^^^^^
SyntaxError: Unexpected identifier
at Module._compile (internal/modules/cjs/loader.js:723:23)
What is wrong? Thanks)