Typescript error while building custom node

Hello good folks of n8n, I have an issue that you might be able to help me with

I am following the instructions to create a custom node so I could use the ‘http’ module in my functions. I keep on getting the error error TS1003: Identifier expected. when i try to build it.

My custom node code is the default code plus this line after the import statements
import * as http from 'http' . Here’s the complete code for your reference https://gist.github.com/sauravtom/4c47e13102a3e1a5f5cc349092afe939

It seems to be a typescript specific error but despite searching online i am unable to fix this, any help regarding this would be greatly appreciated.

If I try to build that node I get the following error message:

SauravCustomNode.node.ts(3,20): error TS1003: Identifier expected.

Looking at the code it seems like there are two commas in the 3rd line and probably causes the problem you are facing:
Screenshot from 2020-07-14 12-01-19

Hope that helps!

1 Like

Lol my sleep deprived brain missed that last night.

Thanks for the pointer, I am able to successfully build the project but I have another question.
After building the node i restarted n8n by sudo docker-compose stop and then sudo docker-compose up -d

on the website when I try to access my custom node I am unable to find it.

Two things that could be wrong here:

  1. You are looking for the wrong name. You called the node actually “Saurav Custom Node”
  2. The .n8n folder you build the node into is different to the one your docker container is using

According to my docker-compose.yml file the n8n volumes folder is /root/.n8n and my custom node files are already present in the folder, but still the custom node doesn’t show up on the vue app UI.

/root/.n8n is where it does get mounted into the docker-container. So if you want that your local /root/.n8n is the same as the /root/.n8n in your docker container you would have to change that line to:

      - /root/.n8n:/root/.n8n

But be aware that if you do that, you should first copy the .n8n folder from wherever ${DATA_FOLDER} points to and copy it to /root/.n8n because else it will not display you the existing workflows anymore (as in this folder is also the SQLite database).

1 Like

Thanks it’s working now