How to actually use the TIDDLYWIKI_PLUGIN_PATH variable?

I’ve been trying to add in a plugin to my node instance using TIDDLYWIKI_PLUGIN_PATH . But it hasn’t worked.

I have an environmental variable set:

TIDDLYWIKI_PLUGIN_PATH=/home/mark/github/TW-Section

Inside of TW-Section is directory source/section which contains the plugin information and of course the plugin.info file

I launch like the following from a directory that is a clone of a pre-release 5.2.1 (?). The editions/tw5.com/tiddlywiki.info file has source/section added to the plugin portion of its configuration:

node tiddlywiki.js editions/tw5.com-server --listen

It runs, but gives message

Warning: Cannot find plugin ‘source/section’

So what am I doing wrong? The example on TiddlyWiki. com is only two lines long and doesn’t contain an example of the file structure or of the source directory.

@Mark_S , I believe the structure of user plugins folder shall be the same as Tiddlywiki/plugins folder e.g
publisher/plugin so you need

TIDDLYWIKI_PLUGIN_PATH=/home/mark/myselectedplugins`
--/myselectedplugins
-- -- kookma
-- -- -- section
-- -- -- commander
-- -- -- shiraz
-- -- wikilabs
-- -- -- links-to-tab

See the installation on Node.js in TW-Section and follow up the instruction! Note to use your path created by environment variable instead of official plugins path!

Note that if you follow my post, all the files/folders are in the specified relative locations, though the directory naming may not make this obvious.

My goal is to not have to move/copy directories around but instead just point the environmental variable appropriately.

Thanks!

In you post you mention two different editions - tw-com and tw.com-server ( editions/tw5.com/tiddlywiki.info and editions/tw5.com-server )

How does your server tiddlywiki.info look like. The plugin-section should be similar to

	"plugins": [
		"tiddlywiki/tiddlyweb",
		"tiddlywiki/filesystem",
		"tiddlywiki/internals",
		"source/section"                  <--- 
	],

This should work. At least it does for me. My TIDDLYWIKI_PLUGIN_PATH variable contains 4 different wiki paths and all work fine

My tw5.com looks like that. It also has the paths to several other plugins which do load. So it seemed reasonable to put the new path there. But maybe the environmental variable is only used before the included tiddlers?

I add source/section to the tw5.com-server/tiddlywiki.info file and now I get TWO messages:

Warning: Cannot find plugin ‘source/section’
Warning: Cannot find plugin ‘source/section’

Perhaps confirm that the TIDDLYWIKI_PLUGIN_PATH variable has been accurately set and is available:

On Unix based systems:
echo $TIDDLYWIKI_PLUGIN_PATH

On Windows I think:
echo %TIDDLYWIKI_PLUGIN_PATH%

For Windows Powershell

gci env: | findstr.exe -I "tiddlywiki"
$ echo $TIDDLYWIKI_PLUGIN_PATH
/home/mark/github/TW-Section

$ cd $TIDDLYWIKI_PLUGIN_PATH

$ tree
.
├── docs
│   └── index.html
...
├── LICENSE
└── source
    └── section
        ├── filters
        │   └── sectionsplit.js.tid
...
        ├── plugin.info
...
        └── viewtemplates
            └── sections.tid

You could print out the paths from within the boot.js by adding a console.log, like so,

$tw.getLibraryItemSearchPaths = function(libraryPath,envVar) {
	var pluginPaths = [path.resolve($tw.boot.corePath,libraryPath)],
		env = process.env[envVar];
	if(env) {
		env.split(path.delimiter).map(function(item) {
			if(item) {
				pluginPaths.push(item);
			}
		});
	}console.log ("paths are "+pluginPaths);
	return pluginPaths;
};

I get

paths are /home/mark/github/tw-personal-plugin-library/plugins
Warning: Cannot find plugin 'source/section'
paths are /home/mark/github/tw-personal-plugin-library/themes
paths are /home/mark/github/tw-personal-plugin-library/languages
paths are /home/mark/github/tw-personal-plugin-library/plugins
Warning: Cannot find plugin 'source/section'
paths are /home/mark/github/tw-personal-plugin-library/themes

It seems like it’s ignoring the variable completely. Maybe it has to NOT find plugins before it uses the path? That is, it’s either/or between local paths and using environmental paths?

When I dump the content of envVar I get

vars are TIDDLYWIKI_PLUGIN_PATH
paths are /home/mark/github/tw-personal-plugin-library/plugins
Warning: Cannot find plugin 'source/section'
vars are TIDDLYWIKI_THEME_PATH
paths are /home/mark/github/tw-personal-plugin-library/themes
vars are TIDDLYWIKI_LANGUAGE_PATH
paths are /home/mark/github/tw-personal-plugin-library/languages
vars are TIDDLYWIKI_PLUGIN_PATH
paths are /home/mark/github/tw-personal-plugin-library/plugins
Warning: Cannot find plugin 'source/section'
vars are TIDDLYWIKI_THEME_PATH
paths are /home/mark/github/tw-personal-plugin-library/themes

But when I dump the value of env I get undefined

processed vars are undefined
paths are /home/mark/github/tw-personal-plugin-library/plugins
Warning: Cannot find plugin 'source/section'
processed vars are undefined
paths are /home/mark/github/tw-personal-plugin-library/themes
processed vars are undefined
paths are /home/mark/github/tw-personal-plugin-library/languages
processed vars are undefined
paths are /home/mark/github/tw-personal-plugin-library/plugins
Warning: Cannot find plugin 'source/section'
processed vars are undefined
paths are /home/mark/github/tw-personal-plugin-library/themes

If I manually edit boot.js and insert the path into the searchpaths function – voila! It works. But it should work without that.

So the upshot is that it is not finding the variable that I set. How would I see the environmental variables that it thinks it can see? Or where is ‘process.env’ defined?


Ok. Looks like there’s a new line that needs to be in the documentation. Apparently it wasn’t enough for me to define the environmental variable, I also had to export it.

Ouch, … That’s a common mistake. Definitely worth mentioning