lonekorean / wordpress-export-to-markdown

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

Something went wrong, execution halted early. #37

Closed nipa-it closed 4 years ago

nipa-it commented 4 years ago

Any suggestion?

nicola@XUBUNTU:~/Desktop/wordpress-export-to-markdown-master$ nodejs index.js

Starting wizard...
? Path to WordPress export file? export.xml
? Path to output folder? output
? Create year folders? No
? Create month folders? No
? Create a folder for each post? Yes
? Prefix post folders/files with date? No
? Save images attached to posts? Yes
? Save images scraped from post body content? Yes

Parsing...
42 posts found.
704 attached images found.

Something went wrong, execution halted early.
TypeError: postContent.matchAll(...) is not a function or its return value is not iterable
    at getItemsOfType.forEach.post (/home/nicola/Desktop/wordpress-export-to-markdown-master/src/parser.js:107:35)
    at Array.forEach (<anonymous>)
    at collectScrapedImages (/home/nicola/Desktop/wordpress-export-to-markdown-master/src/parser.js:102:31)
    at Object.parseFilePromise (/home/nicola/Desktop/wordpress-export-to-markdown-master/src/parser.js:23:18)

Thank you :)

lonekorean commented 4 years ago

Are you running node v12.14 or later?

jayknyn commented 4 years ago

I'm getting this same error and I'm using node v12.16.1.

Thanks for building this tool!

Parsing...

Something went wrong, execution halted early.
Error: Invalid character in entity name
Line: 61513
Column: 67
Char: =
    at error (/Users/jay/code/temp/wordpress-export-to-markdown/node_modules/sax/lib/sax.js:651:10)
    at strictFail (/Users/jay/code/temp/wordpress-export-to-markdown/node_modules/sax/lib/sax.js:677:7)
    at SAXParser.write (/Users/jay/code/temp/wordpress-export-to-markdown/node_modules/sax/lib/sax.js:1491:13)
    at Parser.exports.Parser.Parser.parseString (/Users/jay/code/temp/wordpress-export-to-markdown/node_modules/xml2js/lib/parser.js:323:31)
    at Parser.parseString (/Users/jay/code/temp/wordpress-export-to-markdown/node_modules/xml2js/lib/parser.js:5:59)
    at /Users/jay/code/temp/wordpress-export-to-markdown/node_modules/xml2js/lib/parser.js:338:24
    at new Promise (<anonymous>)
    at Parser.exports.Parser.Parser.parseStringPromise (/Users/jay/code/temp/wordpress-export-to-markdown/node_modules/xml2js/lib/parser.js:336:14)
    at Parser.parseStringPromise (/Users/jay/code/temp/wordpress-export-to-markdown/node_modules/xml2js/lib/parser.js:5:59)
    at Object.exports.parseStringPromise (/Users/jay/code/temp/wordpress-export-to-markdown/node_modules/xml2js/lib/parser.js:378:19)  
nipa-it commented 4 years ago

I can't check now the node.js's version but it's the one I can install with the last Ubuntu 20.04

lonekorean commented 4 years ago

@jayknyn You have a different error: Invalid character in entity name.

The stack trace points to xml2js, which is the third party XML parsing library that my script uses.

Your exported XML may be malformed. I've seen other reports of this happening. You can try running your XML through an online XML parser, see if it passes. Or maybe see if you can spot something that looks funky in your XML on line 61513, column 67.

lonekorean commented 4 years ago

@nipa-it I have a pretty strong suspicion that's what the problem is. matchAll wasn't added to node until v12.0.0, which would explain your error.

nipa-it commented 4 years ago

You got it, it was the version 10.10 of node.js.

Updated everything worked fine.