Has anyone got recent experience of using Jeremy Rushton’s Mbox-to-tiddlers utility?
I am getting the following error and do not know how to solve the problem.
PS C:\Users\robjo\Desktop\mbox-to-tiddlers-master> node ./index.js ./mbox/caroy.mbox ./wiki/tiddlers/converted
C:\Users\robjo\Desktop\mbox-to-tiddlers-master\node_modules\mailsplit\lib\message-splitter.js:28
this.errored = false;
^
TypeError: Cannot set property errored of #<Readable> which has only a getter
at new MessageSplitter (C:\Users\robjo\Desktop\mbox-to-tiddlers-master\node_modules\mailsplit\lib\message-splitter.js:28:22)
at new MailParser (C:\Users\robjo\Desktop\mbox-to-tiddlers-master\node_modules\mailparser\lib\mail-parser.js:132:25)
at module.exports (C:\Users\robjo\Desktop\mbox-to-tiddlers-master\node_modules\mailparser\lib\simple-parser.js:25:18)
at Mbox.<anonymous> (C:\Users\robjo\Desktop\mbox-to-tiddlers-master\index.js:25:2)
at Mbox.emit (node:events:513:28)
at emit (C:\Users\robjo\Desktop\mbox-to-tiddlers-master\node_modules\node-mbox\src\mbox.js:53:12)
at DestroyableTransform.<anonymous> (C:\Users\robjo\Desktop\mbox-to-tiddlers-master\node_modules\node-mbox\src\mbox.js:97:11)
at DestroyableTransform.emit (node:events:513:28)
at addChunk (C:\Users\robjo\Desktop\mbox-to-tiddlers-master\node_modules\readable-stream\lib\_stream_readable.js:291:12)
at readableAddChunk (C:\Users\robjo\Desktop\mbox-to-tiddlers-master\node_modules\readable-stream\lib\_stream_readable.js:278:11)
Node.js v18.16.1
PS C:\Users\robjo\Desktop\mbox-to-tiddlers-master>
Hi @Rob_Jopling I suspect that this is because the utility was written for a much older version of Node.js than the one you are probably using. The dependencies probably need to be updated. I will investigate as soon as I can.
Hi @Rob_Jopling I can confirm that this is indeed a Node.js compatibility problem. mbox-to-tiddlers still works under Node.js 16.x, but 18.x and later versions raise the error you note.
The error is raised within the “mailsplit” library. I updated to the latest version but the problem is not fixed, so I suspect that the solution might be switching to a different library.
Hello @jeremyruston. Digging into the dependency resolution a bit, it looks like an old version of mailsplit is being pulled in as a dependency of mailparser, which specifies exact versions for its dependencies. Updating the minimum version of mailparser to 3.5.0 should pull a fixed version of mailsplit, but that involves a major version change for mailparser.
I’ve done a small bit of testing with this on Node 22 and it appears to work mostly the same, although there are a few small differences in the output compared to using the unmodified version of your script on Node 16.
In the directory where you downloaded the mbox-to-tiddlers code, there is a file called “package.json”. You don’t need to worry about most of what’s in there, but the relevant part looks like this:
Then run “npm install” again. This should pull the latest version of mailparser 3.x that is greater than 3.5.0 (when the patch was introduced for Node 18 and later).
As I said above, I’ve only done some limited testing and there are some differences in the output versus when I ran the script using the old mailparser and Node 16. This also isn’t a tool I’ve used before now, so I can’t say for certain that the output is working 100% correctly after making this change.
If it works well for you, I’d appreciate knowing it did so.
One note of warning: I did see some messages in my mbox files weren’t being read correctly by the “node-mbox” package, resulting in “mailparser” receiving partial messages (eg: no subject or date). This was happening with the original version on Node 16 as well, so I think it’s something about how Thunderbird is storing the messages in the mbox file and not related to these package dependencies.
That worked with no errors. And importing the resulting tiddlers into a tiddlywiki appears to have worked as it should do.
All I need to do now is to rename the tiddlers using the value in the caption field; the message id is actually not a very useful title for the tiddler!!
For your information, the mbox file i used was one generated by Google as a takeout from my Gmail account.