lonekorean / wordpress-export-to-markdown

Converts a WordPress export XML file into Markdown files.
MIT License
1.14k stars 227 forks source link

Cannot read property 'filter' of undefined #25

Closed nvjacobo closed 4 years ago

nvjacobo commented 4 years ago

Hi, node v12.16.1

node index.js

Parsing...

Something went wrong, execution halted early. TypeError: Cannot read property 'filter' of undefined at getItemsOfType (/home/jacobo/wordpress-export-to-markdown/src/parser.js:32:34) at collectPosts (/home/jacobo/wordpress-export-to-markdown/src/parser.js:39:16) at Object.parseFilePromise (/home/jacobo/wordpress-export-to-markdown/src/parser.js:16:16) at async /home/jacobo/wordpress-export-to-markdown/index.js:15:16

lonekorean commented 4 years ago

Looks like it's expecting something in your export file that isn't there. I can't tell what though.

If your export file doesn't contain sensitive data and you're ok with me testing it, I can try it out. You can email me at will at codersblock dot com.

nvjacobo commented 4 years ago

I exported again by the option "all content" and not by" post ". It works

Thanks :)

lonekorean commented 4 years ago

Oh interesting. Glad you got a workaround, I'll keep this issue open to look into.

daveredfern commented 4 years ago

I have the same issue. Here’s what I see (from a full export of WordPress).

Screen Shot 2020-03-28 at 17 25 17

Could you help, please?

Many Thanks in advance.

Dave.

lonekorean commented 4 years ago

@daveredfern did you export "all content" from WordPress (not just posts)?

daveredfern commented 4 years ago

Hi @lonekorean. I tried both and neither worked. I eventually got it to work well when I said no to both image options. Thanks!

lonekorean commented 4 years ago

Alright, finally had a moment to take a closer look.

@nvjacobo I tried to reproduce the issue with creating an export that only had "posts" vs one that had "all content". Could not reproduce. Looking at the error you got, it shouldn't matter as filter should be called on something that always exists, no matter the export. I wonder if there is some sort of malformed XML, which I've seen in another issue. I am not sure.

@daveredfern I think your issue is different. Your screenshot shows fs.promises API is experimental and .matchAll(...) is not a function which are both hints to me that you were running an older version of node. The experimental promises warning went away in v11.4 and matchAll was introduced in v12.0. This script requires node v12.14+.

I am closing this issue since it looks like everyone was able to work around it and I'd need more information to do anymore. This is an older issue and I imagine you have moved on with your lives. :)