Problem running/debugging node-red in Visual Studio Code

#1

Hi,

I have written few flows that have many function in it and I am willing to debug them using visual studio code.

I have followed the instructions provided in GitHub for developers.

I also have an local install done using npm. Which is running fine with no errors except one I menctioned in https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942.
strong text

Now I stopped my locally installed node red and tried to run it with code-base from GitHub using vs code.

Every thing looks fine but I am getting error that ui_base is missing. But I am not getting the same error when I am running locally installed one using npm.

Error details:

9 Sep 19:32:56 - [info] Waiting for missing types to be registered:
9 Sep 19:32:56 - [info] - ui_base

Q1. I think that node-modules that I download will be saved in the user folder and not in the code-base folder inside AppData. So irrespective of running code base form any folder node-red should not be showing this error. Am I missing anything here?

Q2. I am not able to debug node-red form visual studio code. I mean though it starts node-red it will never hit break-point. I don't have much knowledge about how to debug in nodejs with vs(from .net background). I am thinking the build is done in release mode and so debugger points are not loaded. Or is there something I am missing here?

Any help from you guys will be great because it will make my life easy for debugging my flows.

With regards,
Nithin B.

0 Likes

#2

For Q2 I found that it is pointing to /red/red.js(By default), Changed to red.js file and working fine.

Note: I am able to use Attach option and run and I am successfully able to debug. But my Idea is to run using source code.

When I am running I am facing Q2 problem and I can see that there is a function to validate the availability modules. I didn't dig more into it.I think the path where it is looking for modules is not correct.

Because of this I cant see my function nodes not loaded in Loaded scripts tab of vs code --> which I can see when I attach process to node-red in AppData folder.

0 Likes