Error when import workflows

I clone n8n from git and made npm install and build, and everything that is needed, then I copy the folder (after build) to another machine and try to import workflows and this is the error that I get

Hey @Asaf_Shay,

Why are you copying the folder to another machine? Looking at that error you need to run through the install steps again as something went wrong.

the installation process takes too much time, so I want make a folder with n8n ready to go for the machine that actually will run it

So it looks like it is not happy with the import:workflow command, Are you trying this from the main n8n repo or your own? Does n8n also run ok when you make the copy?

It may be handy to know the commands you ran to install, How you copied the folder and what commad you ran to get that error (was it just the import command in the terminal or are you running it from a script)?

source machine : (the machine that I make the n8n ready to go)
0)git clone --branch [email protected] GitHub - n8n-io/n8n: Free and open fair-code licensed node based Workflow Automation Tool. Easily automate tasks across different services.
1)npm install --global lerna
2)git reset --hard
3)git clean -dfx
4)npm i
5)lerna bootstrap --hoist
6)npm run build

target machine : (the machine that get the n8n folder)
1)n8n import:workflow --separate --input=myFolder
2)npm run start

if I run all the commands in the target machine everything is working, but the build process takes too much time, that’s the reason that I split the commands.
I move steps 1,5,6 from the source machine to the target machine and I can achieve success to imports, so my conclusion is that I have to make the build on the target machine, is there another way to make the build on the source machine?

btw
if I try “npm run start” on target machine (only step 2) its also failed,

So you are running all of this from the command line and not scripting any of it? How are you copying the file to the other machine are you compressing it then sending it over?

From what I can see part of what Lerna does is adding some symlinks, I have not looked too much into how it actually works with n8n but it could be that those links are not there which is causing the problem or maybe some files are being missed from the copy process.

Have you thought about using the npm or desktop versions which may be a better solution depending on what you are actually trying to do.

yes, I compressed the folder and upload it to aws s3 and in the target machine I download and uncompress, all the commands that I said I do in nodejs, so I don’t understand your last sentence and how I can resolve this

I appreciate that you are checking because this is a very important point

Hey @Asaf_Shay,

At the moment I don’t have a solution, Have you compared the local files and the compressed files to make sure nothing has been missed?

When you say you are doing the commands in nodejs do you mean through a script? We also don’t document running npm i so it would be interesting to see what happens if you don’t do that and just install lerna, clone the repo then run the bootstrap and build commands.

If I run all the commands in the target machine then it works

That makes sense as you are setting it up all correctly on the target machine instead of making a copy that could be missing something.

Can you try without the npm i on the source machine and also compare the directories to see if anything is missing.

you mean in the source machine not running the npm I and also npm build?

because if in the source machine I make the npm I and in the target machine I make the npm build, then it works

But it’s not good enough for me because the npm build takes time

What I want you to try is the steps we document on the source machine.

npm install --global lerna
git clone --branch [email protected]
lerna bootstrap --hoist
npm run build

Once that is done compress the files then download them on the target machine (manually) or on the source machine into a different folder and compare the folder contents to make sure nothing is missing. If everything is there then try and run the n8n command and see what happens.

compare to what? to the original folder? Do you suspect that the zip is not taken all the files?
and what about npm I? I’m asking because I need to install other packages

I did the process that you write except the compare, the n8n run successfully

So with the compare I wanted to see what happens if you compare the target folders with the source folders.

Just to confirm are you saying that if you follow the steps I mentioned and compress that output works on the target machine?

After a lot of testing, I finally found a way, the problem was in the inner folders in n8n main folder there is a link in node_modules to other node_module on a different directory, and when I use zip package in nodejs most of the zip packages don’t know how to handle this links, its call symlinks, anyway I now use “zip-lib”
and when I zip I don’t use these links i copy the folder inside the link to the current directory, I hope I was understood

@jon thanks a lot !!!

1 Like

Hey @Asaf_Shay,

That is perfect, I mentioned the symlinks yesterday that is part of what the Lerna command does and why I wanted you to check the directory differences :slight_smile:

I am glad this one is finally sorted and you have a solution to achieve what you are after :+1:

@jon now I have another problem when I try to run workflow I get " LoggerProxy not initialized"
the workflow is not even started, Do you have any idea??
@MutedJam Mabey you can help me with this issue?

I found a way, I reinstall Lerna and run it :
npm install --global lerna
lerna bootstrap --hoist

and I don’t need to rebuild all project(so it saves time), I saw that he replace the folders that were in node_modules from regular folder to symlinks, as it should be

2 Likes