11ty / 11ty/import

Error when importing posts from WordPress blogs

Open
#9 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
125
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Using npx @11ty/import wordpress [blog url] --output=public - I can import all of the assets, but as soon as it starts to import posts, it does the following:

Importing post public\blurring-the-lines-extras-by-amy-kaybach.md (5.81kB) from https://www.charlisbookbox.com/blurring-the-lines-extras-by-amy-kaybach/
node:fs:2346
return binding.writeFileUtf8(
^

Error: ENOENT: no such file or directory, open 'C:\Users\demen\OneDrive\Desktop\CharityGambleDeveloper\bookbox\public\blurring-the-lines-extras-by-amy-kaybach.md'
at Object.writeFileSync (node:fs:2346:20)
at Importer.toFiles (file:///C:/Users/demen/OneDrive/Desktop/CharityGambleDeveloper/bookbox/node_modules/@11ty/import/src/Importer.js:462:8)
at file:///C:/Users/demen/OneDrive/Desktop/CharityGambleDeveloper/bookbox/node_modules/@11ty/import/cli.js:142:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\Users\demen\OneDrive\Desktop\CharityGambleDeveloper\bookbox\public\blurring-the-lines-extras-by-amy-kaybach\.md'
}

It does not matter if the public folder is already created or not and this issue happens consistently whether I am attempting to import from a self-hosted WordPress installation or from a WordPress.com blog - the first post that tries to import consistently fails to work because the markdown file doesn't exist. Any ideas why this is happening? I've tried multiple times and it just never imports the posts, only the assets (images).

I'm not sure if this is a weird bug or possibly user-error, but it doesn't seem to matter how I do it or what WordPress source I use, it seems to always do this.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the command with the WordPress URL and inspect the failing write in node_modules/@11ty/import/src/Importer.js at line 462, with the call path from cli.js at line 142. Confirm why the generated post path cannot be opened, then verify that importing WordPress posts completes and writes the markdown files without ENOENT.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, wordpress
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.