How to REMOTE debug with VS code?

Since I could not set up remote debugging with the big Visual Studio 2017:

  • I've red all topics related here,
  • took the advice
  • and finally was able install VS code so it can see and edit the .js files on my Raspberry Pi.
  • also installed extensions I've thought it may be necessary.

That's great (that I do not have to copy the .js and .html files over and over, but directly edit on the Pi) but I still can not debug.

I've tried to upgrade Node-Red to 1.x to the latest (with the recommended script) >> now the whole directory I was developing GOT DELETED ! (Lucky me I've backed up... still, very frightening.)

  • How do I prevent this next time happening?
  • What else do I have to do so the code stops running at the "red break-points"?

Hi,
Have a look at this, looks good explained to me, didn't used it myself yet.

/usr/bin/npm run-script debug
(node:5585) [INSPECTOR_ASYNC_STACK_TRACES_NOT_AVAILABLE] Warning: Warning: Async stack traces in debugger are not available on 32bit platforms. The feature is disabled.

Process exited with code 1

I assume you mean the folder being deleted? Well, you would need to understand what caused it. Certainly just using npm to install a new version of Node-RED doesn't do that and I don't believe running Dave's script would either.

Ultimately though, while Node-RED is amazingly stable and robust, it is still just a collection of code and so can go wrong easily enough.

Backups are your one and only friend.

I have 3 scripts. a Daily backup, a weekly backup and a monthly backup. The 1st keeps 7 daily backups, the 2nd 5 weekly backups, and the 3rd 12 monthly backups. They currently take up 320M & I've shared the scripts previously, they use rsync to keep things efficient.

You need to set an initial breakpoint in settings.js if I remember.

Sadly: YES, it did. (Not the first time, that's why I've made a backup before that.)

If I develop a component, and change the JSON file, it seems it does not match with original on the server (since it is not stable, so It's not merged / uploaded there yet.)
So somehow it gets completely deleted.
IMHO NPM should not be trusted.

  • How do I do that?
  • Will it help with the "32 bit ... " error above? (I don't think it has anything to with it does it?)

Not suggesting something didn't cause it.

Actually, I think that must be something local to you since otherwise I think we would see a lot more noise in the forum here and I don't believe we do.

Urm, not really sure what you are doing there. Are you making changes to the flow json file somewhere else and then using npm to update on another device?

There are plenty of failings with npm but it would seem that you are doing something slightly odd here - if you could perhaps explain a little more what you are doing?

You add the debugger keyword somewhere in the file. doesn't have to be inside the exports section. I've not done it for ages so I'm a little sketch on it.

You still have to run Node-RED the --inspect keyword, something like:

node --inspect node_modules/node-red/red.js --userDir ./data

Obviously, you need to change the paths according to your own setup.

Couldn't really say since I've never tried to debug on a 32bit system. Also it may depend on how you are running things. Not sure.

Wow! That's new to me! This could be it...
But I never used the keyword node to start node-red, only node-red-start.
If I simply type node into a SSH terminal, it starts some kind of editor.
Also I don't know what directory this ./data is?

Almost all Raspberry Pi systems are 32 bit by default! That's why it's interesting, why nobody is complaining about this error...
The GitHub ticket has been made read-only too.

PS: Thank you for your help! :slight_smile:

I’ll chime in that I once had all my flows blanked out (tabs were still there but all were empty) this was also on a pi. Wasn’t able to pin what exactly caused it, I was probably doing something weird, but the lesson was learned - there’s no replacement for regular backups.

I have changed the version numbers (from 1.xxx to 2.yyy) in the package.json file.

Well, if you want to get into deep debugging, you need to lift up the covers and peer within a little :slight_smile:

If you type just node, you are in a Node.js "REPL" - an interactive Node.js command line shell. The command I showed runs Node.js with 2 arguments, the --inspect and the javascript file to run (red.js). The final argument is one for Node-RED rather than Node.js, it tells Node-RED where to find its userDir folder (that contains all of the config, flows, etc).

I never run Node-RED as a global install, I always run it as a local install with the userDir folder within the folder that Node-RED is installed to. See the alternate installer repo on my GitHub for details.

Depending on how you have installed Node-RED, both the location of the RED.js file and the location of your userDir may be different.

ARMv7 and below are 32-bit. AMRv8 introduces the 64-bit instruction set. Type the command lshw to see what you have.

Typically Pi3 and below run 32-bit and Pi4 runs 64-bit I believe but I think that the Pi3 can run 64-bit (I've not tested it).

That's because the repository that it refers to is no longer in use and has been deprecated.

THe "error" is only a warning anyway so debugging should still work.

I think that this statement is not correct. This has nothing to do with npm.

2 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.