I am trying to include an already published custom n8n-nodes-module in my local development version of n8n. Am I supposed to add it as a dependency in the cli package? I tried this approach, and then when running my build, I get a bunch of TypeError: Cannot read property 'loading' of undefined errors and a DOMException: Failed to execute 'appendChild' on 'Node': This node type does not support this method. error in the browser console. It seems these errors prevent the main workflow editor UI from loading, as I can only see the sidebar and Workflow title header.
I do not believe the issue is with the custom n8n-nodes-module because it works correctly with the published version of n8n installed normally with npm install n8n.
None of the code I modified in my local version of n8n is related to nodes either.
Edit: I’ve resolved the browser errors (wasn’t supplying the necessary environment variables during the build), but I do not see my custom node in the list of nodes.
On startup n8n checks for npm-modules which are installed alongside n8n and if they have any nodes defined. If it finds any, it loads them. So it sounds like that for some reason it can not “see” them.
What you did sounds correct. If you added it as a dependency to the “cli” module it should end up at a location where n8n cand find it. After you added it, did you run again `lerna bootstrap --hoist"? If not you can try that.
After adding the dependency to the cli module’s package.json and running the bootstrap command, I saw the module was downloaded to the root directory’s node_modules folder. Then I found the source code that looks for n8n-node packages and saw that it was looking in the cli module’s node_modules folder, so I added an npm command to copy my custom n8n-node module into there, and then it got picked up. Not sure if this was intended, but everything works now!
I wasn’t sure if I was supposed to run npm install <custom-n8n-node> or just add it to the cli’s package.json, but when I attempted the former, I got lots of No such file or directory errors.