[Bug] Error when running command "n8n export:workflow --backup --all" on Windows VDS

Describe the issue/error/question

Have a fresh VDS, i’ve installed n8n and tried to run the Command node.

I believe it’s either an internal issue with paths on Windows, or it also might be caused that I have a username with 2 parts “Vet Auto” (not quite likely, but still worth keeping in mind).

C:\Users\Vet Auto\AppData\Local\Programs\n8n - it is valid path, and it contains n8n.exe

What is the error message (if any)?

ERROR: Command failed: n8n export:workflow --backup --all node:internal/modules/cjs/loader:937 throw err; ^ Error: Cannot find module 'C:\Users\Vet Auto\AppData\Local\Programs\n8n\export:workflow' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:934:15) at Module._load (node:internal/modules/cjs/loader:779:27) at Function.c._load

Please share the workflow

Information on your n8n setup

  • n8n version: 0.174.0
  • Database you’re using (default: SQLite): -
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: desktop app, Windows, manual run

Also, I’ve tried to exec forced file name

n8n.exe export:workflow --backup --all

But the error is the same

Hm, unfortunately I don’t have n8n running on actual Windows asides from the desktop (the Windows approaches to node.js version management give me headaches) so I am not entirely sure what might be wrong here.

I gave installing n8n a go via npm install -g n8n on Windows just now and the CLI is working as expected for me. Is this how you installed n8n? How would you typically launch it?

Can you confirm what npm root -g returns for you and whether the CLI works through cmd.exe directly for you?

I’ve picked the simplest option: installed it via the installer and just run the standalone exe.

npm install was ok, and after i run it (in the browser, not Electron), the command works fine.

Tried to run the standalone again, and get the same error again.

Browser version is a workaround for me for now, but i’d definitely take a closer look at the standalone version

I’ve picked the simplest option: installed it via the installer and just run the standalone exe.

Oh, so you’re using the desktop version of n8n? Let me test this, brb :slight_smile:

1 Like

Okay, so I gave this a go using n8n desktop and it seems to work fine when specifying the full path to the n8n.cmd file used by n8n.desktop (like "C:\Users\Vet Auto\AppData\Local\Programs\n8n\resources\app\node_modules\n8n\bin\n8n.cmd" export:workflow --all):

Perhaps you could give this a go @yavetal?

1 Like

Can i like your message 2 times? :))

Yep, that path works! I’ve tried the path to exe, but no luck. Should have tried path to cmd (its a bit hidden in rsources tho)!

1 Like

Glad to hear this helps!

The problem here would be n8n desktop not installing or registering the n8n command globally, so that’s why the full path to the actual server executable behind the desktop exe was necessary.

I think the behaviour itself is fine (seeing users might install n8n desktop in addition to the npm version for example), but perhaps the full path information should be added to the documentation. Wdyt @deborah?

1 Like

@MutedJam sure!

1 Like