Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of undefined (reading 'parentNode') #129

Open
ligi opened this issue Oct 14, 2024 · 2 comments
Open

TypeError: Cannot read properties of undefined (reading 'parentNode') #129

ligi opened this issue Oct 14, 2024 · 2 comments

Comments

@ligi
Copy link

ligi commented Oct 14, 2024

tried an export - got this:

node index.js

Starting wizard...
? Path to WordPress export file? /home/ligi/Downloads/wp_export.xml
? Path to output folder? output
? Create year folders? Yes
? 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
? Include custom post types and pages? No

Parsing...

Something went wrong, execution halted early.
TypeError: Cannot read properties of undefined (reading 'parentNode')
    at isHeadingRow (/home/ligi/git/3rd/wordpress-export-to-markdown/node_modules/turndown-plugin-gfm/lib/turndown-plugin-gfm.cjs.js:100:23)
    at Object.filter (/home/ligi/git/3rd/wordpress-export-to-markdown/node_modules/turndown-plugin-gfm/lib/turndown-plugin-gfm.cjs.js:77:41)
    at filterValue (/home/ligi/git/3rd/wordpress-export-to-markdown/node_modules/turndown/lib/turndown.cjs.js:416:16)
    at findRule (/home/ligi/git/3rd/wordpress-export-to-markdown/node_modules/turndown/lib/turndown.cjs.js:404:9)
    at Rules.forNode (/home/ligi/git/3rd/wordpress-export-to-markdown/node_modules/turndown/lib/turndown.cjs.js:389:17)
    at TurndownService.replacementForNode (/home/ligi/git/3rd/wordpress-export-to-markdown/node_modules/turndown/lib/turndown.cjs.js:898:25)
    at /home/ligi/git/3rd/wordpress-export-to-markdown/node_modules/turndown/lib/turndown.cjs.js:863:40
    at NodeList.reduce (<anonymous>)
    at TurndownService.process (/home/ligi/git/3rd/wordpress-export-to-markdown/node_modules/turndown/lib/turndown.cjs.js:856:17)
    at TurndownService.replacementForNode (/home/ligi/git/3rd/wordpress-export-to-markdown/node_modules/turndown/lib/turndown.cjs.js:899:25)
@habi
Copy link

habi commented Oct 20, 2024

I get the same error.

  • macOS Sonoma 14.6.1 (23G93)
  • node -v gives v20.18.0
  • I start the process with npx wordpress-export-to-markdown

@caranha
Copy link

caranha commented Nov 3, 2024

I had the exact same error.

It turns out, in my case, it was a html table in one of my posts that was not properly closed, and was making the html parser library (turndown) to choke. Fixing the missing tag in my XML fixed the problem.

Check the tables in your xml, and see if there are any ones that are unclosed, that might be it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants