Uncaught TypeError: Cannot read property 'split' of undefined
See original GitHub issueI get this error when using csvtojson.
My node version is v7.10.0
.
Converter.js:85 Uncaught TypeError: Cannot read property 'split' of undefined
at Object.<anonymous> (Converter.js:85)
at Object.module.exports (Converter.js:542)
at __webpack_require__ (bootstrap 6e0e07b…:659)
at fn (bootstrap 6e0e07b…:85)
at Object.<anonymous> (index.js:2)
at __webpack_require__ (bootstrap 6e0e07b…:659)
at fn (bootstrap 6e0e07b…:85)
at Object.<anonymous> (csv2json.js:2)
at __webpack_require__ (bootstrap 6e0e07b…:659)
at fn (bootstrap 6e0e07b…:85)
When I import csvtojson, this error occur.
import CSV from 'csvtojson';
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
How to prevent cannot read property split of undefined
This error is a TypeError , and it occurs when calling a method, operand, or argument on the wrong data type, or when...
Read more >How to Prevent cannot read property split of ... - Gopi Gorantala
The "cannot read property 'split' of undefined" error occurs when trying to call split() method on a variable that stores an undefined value....
Read more >Cannot Read Property 'split' of Undefined - freeCodeCamp
it will throw the TypeError: Cannot read property 'split' of undefined error. The split method. When split is called on a string, it...
Read more >Uncaught TypeError: Cannot read property 'split' of undefined
Your question answers itself ;) If og_date contains the date, it's probably a string, so og_date.value is undefined.
Read more >TypeError: Cannot read property 'split' of undefined - JavaScript
So the argument word is coming in as undefined and therefore you can't run split() on it. You can either make sure it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Same. It happens because Converter.js is using
process.versions.node
here:https://github.com/Keyang/node-csvtojson/blob/46f97473b6ab68d40f82e5217668beab51b4e183/libs/core/Converter.js#L85
Which is not available using a bundler like webpack (in my case) in the frontend. @Keyang, this can by fixed by checking if the function is available dynamically:
You can quickly check the behaviour:
@Kaylang, should I create a pull request?
@takanorip You can downgrade csvtojson in your package.json to 1.1.5 to get it working for the moment:
It looks like the change is already available in 1.1.8, please update.