Can't see any change after i import workflow from file

So you are using this option?

image

In this case you would not have to use the square brackets - sorry, I was just really confused as to what exactly you were doing based on your other recent questions around this topic. It would, however, not set the name of a workflow as you have noticed. Instead the UI would solely import the content of the workflow file (similar to using the Ctrl+V keyboard shortcut when you have workflow JSON in your clipboard).

ok I understand, thanks

1 Like

I try to run in the CLI
n8n execute --id=4
it seems (i still check) that is working but I still get errors in the command line
There was a problem running internal hook “onWorkflowPostExecute” Error: InternalHooks not initialized

my workflow only have start node

Thanks so much for reporting this @Asaf_Shay! These hooks are relatively new, but are not relevant/required when using the CLI. So you can safely ignore the InternalHooks not initialized error thrown by the CLI for now. I have also raised this as a bug internally, so we can work on fixing this in a future release. Please accept my sincere apologies for the inconvenience this might have caused.

Hi @Asaf_Shay, the aforementioned issue has been fixed with the 0.149.0 release

Hi @Asaf_Shay, to follow up on your question posted earlier in a new topic, could you please double-check whether the import of workflows works when importing workflows previously exported via the CLI rather than the UI?

If not, could you share examples of the files you are unable to import along with the steps you took to export them in the first place? Thanks so much!

I look here

I try import workflows when each workflow has its own file, I used --separate as it says in your DOC, and not working

I see that you are using the --separate option but at this stage I am a bit confused how you exported your workflows in the first place. Could you share these details and ideally also an example of a workflow you have exported?

1 Like

I exported using cli like this
n8n export:workflow --all --separate --output=test
the workflow is very basic, his only have start node

{“id”:18,“name”:“workflow upload”,“active”:false,“nodes”:[{“parameters”:{},“name”:“Start”,“type”:“n8n-nodes-base.start”,“typeVersion”:1,“position”:[250,300]}],“connections”:{},“createdAt”:“2021-11-15T09:43:46.199Z”,“updatedAt”:“2021-11-15T09:43:46.199Z”,“settings”:{},“staticData”:null}

1 Like

Thanks for providing these details!

I did now manage to reproduce the problem you have described on Windows when trying to import files via n8n import:workflow --separate --input=test that were previously exported via n8n export:workflow --all --separate --output=test:
image

The same command works fine on Linux:

Based on this I suspect this could be a problem with the CLI not looking in the right path here. I’ll take a closer look this afternoon and see if I can come up with a workaround here.

Hey @MutedJam,

Had a quick play here on a Windows VM and it looks like the problem is around here: n8n/workflow.ts at 7a37f73eaed32e88123dfcc48847f42b1cfcf193 · n8n-io/n8n · GitHub

If I chance later and you have not already done it I will have more of a play.

1 Like

Thanks a lot @jon, I was looking at this on a native machine running Windows 11 and was actually throwing a bunch of console.logs around that statement in the first step. At the moment I am struggling to build n8n and some other applications (working fine in WSL, not on the host OS). I think there’s with the Windows build tools not liking my machine.

This will probably take a while to sort so I might need to revisit this tomorrow :frowning:

To be honest I installed through NPM then looked in the NPM package files and edited it that way so I didn’t need to recompile, Did the same thing with the console.log() to see what was going on.

So it seems the package fast-glob is expecting forward slashes, even on Windows. When replacing these strings the import does indeed work:

...
if (flags.separate) {
    const input = flags.input.replace(/\\/g, '/');
    const files = await glob(
        `${input.endsWith('/') ? input : input + '/'}*.json`,
    );
...


(ignore the lines above “Succesfully imported 2 workflows.”, that’s just my console.log)

Though such a replacement might have other implications, not sure if any file systems allow backslashes in path names. I’ll think some more about this tomorrow and will either propose a PR or hand this over as a bug in more capable hands depending on how that thought process ends :wink:

1 Like

I would maybe use process.platform to get the OS and then use the result of that for the path setting.

1 Like

I’ve raised a PR using process.platform as suggested by Jon: 🐛 CLI: Add windows support to import:workflow --separate by that-one-tom · Pull Request #2441 · n8n-io/n8n · GitHub. This works on both Windows and Linux.

Let’s see what the team says :slight_smile:

2 Likes

Fix got released with [email protected]

thanks, when do you plan to upload to git?

@Asaf_Shay it is already merged and is in version 150 which you should be able to update to now by pulling the latest docker image.

If you are running from source it has been available for about 2 days.

2 Likes

thanks, very helpful

2 Likes