Error using build targets

Hello, I’m trying to setup my tiddlywiki.info file to be able to build a single html file from my nodejs instance. I want to include the external images _canonical_uri field configuration too.

Here’s my tiddlywiki.info file:

{
    "description": "Basic client-server edition",
    "plugins": [
        "tiddlywiki/tiddlyweb",
        "tiddlywiki/filesystem",
        "tiddlywiki/highlight"
    ],
    "themes": [
        "tiddlywiki/vanilla",
        "tiddlywiki/snowwhite",
        "tiddlywiki/centralised"
    ],
    "build": {
        "index": [
            "--output", "/home/alex/dev/public_wiki",
            "--savetiddlers","[is[image]]","images",
            "--setfield","[is[image]]","_canonical_uri","$:/core/templates/canonical-uri-external-image","text/plain",
            "--setfield","[is[image]]","text","","text/plain",
            "--render","$:/plugins/tiddlywiki/tiddlyweb/save/offline","index.html","text/plain"
        ],
        "static": [
            "--rendertiddler",
            "$:/core/templates/static.template.html",
            "static.html",
            "text/plain",
            "--rendertiddler",
            "$:/core/templates/alltiddlers.template.html",
            "alltiddlers.html",
            "text/plain",
            "--rendertiddlers",
            "[!is[system]]",
            "$:/core/templates/static.tiddler.html",
            "static",
            "text/plain",
            "--rendertiddler",
            "$:/core/templates/static.template.css",
            "static/static.css",
            "text/plain"
        ]
    }
}

In the folder ~/dev/wiki where the tiddlywiki.info file is I then run this command: tiddlywiki wiki --build index but get the following error:

$:/core/modules/commands/build.js:27
        var buildTargets = $tw.boot.wikiInfo.build;
                                             ^

TypeError: Cannot read properties of null (reading 'build')
    at Command.execute ($:/core/modules/commands/build.js:27:39)
    at Commander.executeNextCommand ($:/core/modules/commander.js:107:14)
    at Commander.execute ($:/core/modules/commander.js:64:7)
    at exports.startup ($:/core/modules/startup/commands.js:34:12)
    at $tw.boot.executeNextStartupTask ($:/boot/boot.js:2545:10)
    at $tw.boot.executeNextStartupTask ($:/boot/boot.js:2543:21)
    at $tw.boot.executeNextStartupTask ($:/boot/boot.js:2543:21)
    at $tw.boot.executeNextStartupTask ($:/boot/boot.js:2543:21)
    at $tw.boot.executeNextStartupTask ($:/boot/boot.js:2543:21)
    at $tw.boot.executeNextStartupTask ($:/boot/boot.js:2543:21)

Node.js v19.3.0

Using --verbose I get slightly more:

Boot log:
  Startup task: load-modules
  Startup task: info after: load-modules before: startup
  Startup task: plugins after: load-modules
  Startup task: startup after: load-modules
  Startup task: story after: startup
  Startup task: commands platforms: node after: story
Executing command: version
5.2.5
Executing command: build index
$:/core/modules/commands/build.js:27
        var buildTargets = $tw.boot.wikiInfo.build;
                                             ^

TypeError: Cannot read properties of null (reading 'build')
    at Command.execute ($:/core/modules/commands/build.js:27:39)
    at Commander.executeNextCommand ($:/core/modules/commander.js:107:14)
    at Commander.executeNextCommand ($:/core/modules/commander.js:111:12)
    at Commander.executeNextCommand ($:/core/modules/commander.js:111:12)
    at Commander.execute ($:/core/modules/commander.js:64:7)
    at exports.startup ($:/core/modules/startup/commands.js:34:12)
    at $tw.boot.executeNextStartupTask ($:/boot/boot.js:2545:10)
    at $tw.boot.executeNextStartupTask ($:/boot/boot.js:2543:21)
    at $tw.boot.executeNextStartupTask ($:/boot/boot.js:2543:21)
    at $tw.boot.executeNextStartupTask ($:/boot/boot.js:2543:21)

Node.js v19.3.0

thanks for you help.

Turns out I just needed to reference the wiki source directly, with the command:

tiddlywiki ~/dev/wiki --build index

1 Like