[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

A small bit of necromancy here (probably a note for the future me) :slight_smile:

While working on the syncer ( Syncing local n8n workflows with remote host ) i’ve figured out that it’s better to install n8n via npm.

I’ve ended up with command (%AppData%/npm/n8n start || n8n start)
The left part is for Windows. n8n is available there, after installing globally npm install n8n -g.
The right part is for Mac, as n8n is available straight away after the installation.
Haven’t tested on Linux, but expect it to work similarly.

If using the Desktop installation, still the path above can be unified to
“%AppData%\Local\Programs\n8n\resources\app\node_modules\n8n\bin\n8n.cmd” (not tested tho)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.