I am trying to create a Custom node. It’s working when file name is ExampleNode.node.js this and if a change folder name, file name and class name then getting error :
TypeError: require(…).TestNode is not a constructor
It looks like your topic is missing some important information. Could you provide the following if applicable.
- n8n version:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system:
Hi @Neeru_Olha,
Welcome to the community
The error you’re seeing typically occurs when there’s a mismatch between how the module is exported and how it’s being imported. Here are a few things you can try out:
- Can you double-check that you’ve replaced ‘ExampleNode’ with your custom node name in all the required places?
- Can you check your
package.json
file and make sure it correctly references the node - Can you try rebuilding & restarting your custom node and n8n?
It’s hard to troubleshoot without actually seeing the code though, could you maybe share more details about what you’ve done so far?
Hi @aya ,
This is how I’m writing the class:
export class TestNode implements INodeType {
description: INodeTypeDescription = {
displayName: ‘test Node’,
name: ‘testNode’,
}
}
I have updated the package.json
file with the correct file path:
“nodes”: [
“dist/nodes/TestNode/TestNode.node.js”
]
However, despite rebuilding multiple times, I am still encountering the same error.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.