Portable Node.js TW won't start on new Linux machine from OneDrive

I created a portable Node.js TW install on my OneDrive cloud, following this tutorial:
Getting Started with Node.js on Windows: TW5 Tribal Knowledge — TiddlyWiki Notes and Tips (techlifeweb.com)
When I created it, it worked with both Windows and Linux.
I created it from the Windows command prompt.
I used it with Linux so I could start it with nohup, so that I could close the terminal after I started it.
In Windows the command prompt must stay open after start.
Now from my new Windows machine it works from OneDrive seamlessly, but not from my new Linux machine (it’s Ubuntu via WSL2).
This is the command I use for Linux to start it:
cd /mnt/c/Users/wikil/OneDrive/node && nohup tiddlywiki mynewwiki --listen
and I used this same command on my previous Linux install (also WSL2) and it worked.
I get the error message:
“tiddlywiki: command not found”
But it’s running fine from Windows, so it means that Tiddlywiki is already installed in that folder, so I cannot install it again.
How do I solve this issue?
I run it with the tiddlywiki mynewwiki --listen command from the same “node” folder in Windows, and it works, but not in Linux.
The whole portable thing is already installed in OneDrive, including TiddlyWiki and the portable Node unpacked.
My Node folder is set to “always keep on this device” in the OneDrive settings so they don’t need to be used from the Cloud.

Those instructions don’t say anything about making something windows/linux compatible. Not that I can tell. But they do use

npm install -g tiddlywiki

That will install tiddlywiki globally. So, in that scenario you must have run the command on linux and on windows. So the tiddlywiki node code actually lives on each target machine. If it’s been awhile, you may have forgotten about that.

You could try installing tiddlywiki locally (in that dir). I’m thinking that to get your exact same arranngement that you will need to run

npm install -g tiddlywiki

once on your linux machine.

Something I don’t understand here.
If I already ran “npm install -g tiddlywiki” (which I did for sure) at the time when I installed the whole thing on into my OneDrive, why do I have to run it again?
Maybe I ran it in both Windows and Linux, I don’t remember, but I ran it once for sure in Windows.
What this command does is that it copies some files into that folder, and that’s it, that’s why I don’t understand why do I have to run it again?
I will run it on Linux now, hopefully it will not mess up my install or it would not create a double install.

When you install with the -g option, it installs globally. That means it’s installing something in your roaming data (can’t remember the exact directory name) on Windows. For it to work on Linux, you must have run the same command while running linux, which would have installed the tiddlywiki components somewhere under your node directory. (subdirectory ./lib/node_modules/tiddlywiki).

If you still have your old linux machine, you can verify this by going to any directory and typing

which tiddlywiki

This should show the path to where your tiddlywiki instance is stored.

I see. That means that using this method it doesn’t fully run off of my OneDrive, it requires installed components on the local machine too…
So if this would be installed on a pen drive instead of One Drive, I can’t just plug my pen drive in into any computer and run my TW straight away from portable Node.js?

You can probably extract and use the executable node binaries from Linux/Windows into their own directories. I found these instructions where someone had done this on Windows: Use Node without installation and admin access | by Md Rafee | Nerd For Tech | Medium

In this case you would install tiddlywiki locally (from either working machine). Then when on a different machine, put the node executable on your path. Then from the command line run something like:

node tiddlywiki.js mynewwiki --listen

If you’re going to be running on friend’s linux and windows machines, then you would need executables for both operating systems, and set the path to whichever one you’re using.

So, with a little work, you might be able to make your own portable system.

Always make backups!

This is how I am running it from Windows, currently:
C:\Users\myusername\OneDrive\node>tiddlywiki mwnewwiki --listen
So I am running it from the “node” directory, that’s where I have node unpacked (not installed).
This is how my directory in my One Drive looks:


I can see double entries, like: npm / npm, npx / npx
Since I am already in the “node” directory, do I still have to execute
node tiddlywiki.js mynewwiki --listen
or just
tiddlywiki.js mynewwiki --listen?
Would it be okay to duplicate my “node” folder on an other name and run there
npm install -g tiddlywiki
to make sure I don’t mess up my current install?
But since this setup is a portable setup meant to be run from the cloud, or from a USB memory, how come it’s still required to install Tiddlywiki on the local machine?

Can someone please from this community help sort out this issue?
Especially someone who can try it with the same setup, Linux (Ubuntu) on WSL2 on Windows, and One Drive.

Taking a step back, have you already tried using the window’s start command?

Not yet, what would the full command be to start TiddlyWiki with the start command?

On linux, “tiddlywiki: command not found" likely means that your current directory . is not in the PATH environment variable. You’d need to type ./tiddlywiki to run the shell script found in the current working directory. (or add node.js directory to your linux’s PATH environment variable) However, you’d probably run into node not found error next…

There are probably a few ways you could try. Assuming wsl has set up PATH correctly so the system can find cmd.exe, etc. AND you’re in the OneDrive\node directory, try:

cmd.exe /c tiddlywiki.cmd --version

cmd.exe /c tiddlywiki.cmd mynewwiki --listen

(If cmd.exe not found, you’d have to give its full path: /mnt/c/Windows/System32/cmd.exe

Alternatively, you could run node.exe directly, e.g:

./node.exe node_modules/tiddlywiki/tiddlywiki.js --version

If that works, edit the shell script accordingly. If you want to use the absolute path for the js file, use the windows format, e.g. c:/Users/wikil/OneDrive/node/node_modules/tiddlywiki/tiddlywiki.js Actually, you’d need to use Windows path for your wiki folder as well.

Hope this helps.

These work well from Linux now, thanks!

By the way do you know Windows alternative for the Linux “nohup” command?
Because that’s why I want to use Linux with this, in Windows the terminal window must stay open :((
In Linux I can close the terminal window after starting it with nohup.

But why do I need to type windows commands in the Linux terminal to start it from Linux?
Like cmd.exe and cmd?
Why cannot I start it solely with Linux commands, from Linux?

cd /mnt/c/Users/mobil/OneDrive/node && nohup tiddlywiki mynewwiki --listen
this is the command with nohup that I used previously in my previous Linux install when I created my OneDrive setup
now moved to the new Linux install I seem to need this to start it (using your help):
cd /mnt/c/Users/mobil/OneDrive/node && nohup cmd.exe /c tiddlywiki.cmd mynewwiki --listen
and it will start but the nohup will not last, once I close the Linux terminal, the process stops.
Could you help with this?

"nohup: ignoring input and appending output to ‘nohup.out’ "
nohup successfully works but why will the process stop if I close the Linux terminal?
The process were kept after closing my terminal with my initial command:
cd /mnt/c/Users/mobil/OneDrive/node && nohup tiddlywiki mynewwiki --listen

Have you tried TidGi app, which is optimized for nodejs wiki on all platforms?

1 Like

Hi @mobil_gmail.com

But why do I need to type windows commands in the Linux terminal to start it from Linux?

Your node.js installation does not contain linux executables. I could tell because the linux binary named node does not exist in this folder. In linux, you’re required to type the exact path/filename of the program you want to execute or it will search for the program in the order specified in the environment variable PATH. So I’m wondering perhaps there’s a linux installation of node.js in your older machine somewhere? That could explain why you had no problems before… You could investigate by typing (under the WSL environment on your old machine):

which tiddlywiki
which node

to identify the locations of the executables.


Now back to your objective:

I think you could try using some sort of script in Windows to start a persistent process and exit the calling program. But here’s one quick and dirty way, by utilizing powershell’s -windowstyle hidden feature:

  1. Open Windows Explorer and navigate to your node folder. Pick tiddlywiki file, right-click, and create a shortcut.

  2. Right-click on the shortcut that you just created and select “Properties” menu.

  3. In the “Target” field, replace the entire string with:

    powershell -windowstyle hidden ./tiddlywiki mynewiki --listen
    
  4. Verify that the “Start in” field has the absolute path of your node.js folder. Click OK when done.

  5. Now try running the shortcut by double-clicking it. You’ll probably see a window pops up and disappears immediately, but you could check the run status either by opening your wiki page in the browser, or by looking for “Node.js JavaScript Runtime” item in task manager.

    If something goes wrong and you need to debug, just replace the hidden value with normal; and you may add -noExit option to the powershell too.

You could run the above powershell command in a console window as well. (The console will close as a result of running the command.)

1 Like

I followed your instructions, the command promt will get hidden but Tiddlywiki will not start.
My issue is not with Tiddlywiki, it’s with nohup, because my last command:
cd /mnt/c/Users/mobil/OneDrive/node && nohup cmd.exe /c tiddlywiki.cmd mynewwiki --listen
successfully starts Tiddlywiki from the WSL2 Linux terminal, and nohup also seems to work, because I am getting:
nohup: ignoring input and appending output to ‘nohup.out‘, but it doesn’t because the process stops when I close the WSL2 terminal.
So this must be a command syntax issue or a WSL2 issue, regarding nohup.
But if it would be a syntax issue, then nohup wouldn’t work, and wouldn’t report:
nohup: ignoring input and appending output to ‘nohup.out‘
and Tiddlywiki wouldn’t start.
So it might be an issue between nohup and WSL2?

./node.exe node_modules/tiddlywiki/tiddlywiki.js --version
this works
what would be the command with nohup then to only use Linux syntax that works with nohup together with the command above?
or once it contains node.exe it cannot be considered a Linux syntax command anymore that won’t mess with the nohup utility?