I don't understand how to install third party plugins with Node.js

I made another attempt to understand this mode of TiddlyWiki operation, and I’m not happy with the outcome.

Reference official docs:

The docs about plugin folders mention a plugins subdirectory in a Node.js TiddlyWiki. This is great, but after creating an empty wiki, then importing content to it from a single HTML file wiki using the tiddlywiki --load command, all the single tiddler files are dumped into a tiddlers directory, including tiddlers that belong to plugins. You’d imagine that it’s expectable to have them separated in a plugins subdirectory or something, but nada. And tiddlywiki --help load does not tell anything about that.

Next, a quote:

On the server, plugins can be stored as ordinary JSON tiddlers but it is often more convenient to store them as separate tiddler files within folders.

I take the first part of this as a promise that if I have a single HTML file wiki, go to its installed plugins and export one of them as single JSON file, the Node.js TiddlyWiki will be happy to process it as long as it put it inside the plugins subdirectory and reference it in tiddlywiki.info.

I’ve tried it:

{
    "description": "Basic client-server edition",
    "plugins": [
        "tiddlywiki/tiddlyweb",
        "tiddlywiki/filesystem",
        "tiddlywiki/highlight",
        "anacletus/tiddlychess"
    ],
    "themes": [
        "tiddlywiki/vanilla",
        "tiddlywiki/snowwhite"
    ],
    "build": {
        "index": [
            "--render",
            "$:/plugins/tiddlywiki/tiddlyweb/save/offline",
            "index.html",
            "text/plain"
        ],
        "static": [
            "--render",
            "$:/core/templates/static.template.html",
            "static.html",
            "text/plain",
            "--render",
            "$:/core/templates/alltiddlers.template.html",
            "alltiddlers.html",
            "text/plain",
            "--render",
            "[!is[system]]",
            "[encodeuricomponent[]addprefix[static/]addsuffix[.html]]",
            "text/plain",
            "$:/core/templates/static.tiddler.html",
            "--render",
            "$:/core/templates/static.template.css",
            "static/static.css",
            "text/plain"
        ]
    }
}

, "anacletus/tiddlychess" is my only manual addition to this file, and

$ ls -lh plugins
total 988K
-rw-rw-r-- 1 user users 986K Feb 21  2025 $__plugins_anacletus_tiddlychess.json

So the thing is there, but at startup I get

$ tiddlywiki-5.3.8 mytiddlywiki --listen
Warning: Cannot find plugin 'anacletus/tiddlychess'

There’s also [tw5] Installing plugins on node.js installation - #5 by LoryMoney with a relevant question hanging in the air, in case I interpreted the docs the wrong way and plugins can’t be added from one JSON file but rather from a collection of multiple files containing one tiddler each.

I think you are trying this:

Plugins found using the OS environment variables

It is the method recommended by flibbles’ UglifyJS and I personally never managed to get it working.

I use the second method instead.

When I loaded my existing single-file wiki into node, it actually created a plugins/ folder. It should look like this in your wiki root:

. <-- the root folder for your wiki
├── plugins
│   ├── 3click2edit
│   ├── add-sibling
│   ├── AutoComplete
│   └── ... etc
├── tiddlers
│   └── tiddlers go here.tid
├── tiddlywiki.info
└── your_wiki.html

For downloading plugins:

  1. Go to their source code
  2. Find the plugins folder
  3. Download the entire contents of that (or at least the appropriate sub-folders - each folder is a separate plugin)
  4. Extract it into your own plugin folder

See the example of relink for how that’s laid out. In most plugin source code repositories, the plugin you are downloading is the only subfolder.

OS environment variables

I’ve never tried it this way

You’re not saying how exactly are you doing it. Perhaps you do it in a different way, using different command line arguments?

There’s a big advantage in setting the TIDDLYWIKI_PLUGIN_PATH environment variable once, remember its path and put node.js plugins into that path:
You can share the plugins with all your node.js wikis. If you update the plugin, it updates in all your wikis that include it from the TIDDLYWIKI_PLUGIN_PATH.

I know how to do this on Windows and Linux, so if you need a How To just tell me the OS :wink: