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
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?
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):
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?
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)