Cannot start Node-RED on MSYS2

Hi folks,

I'm have been trying to debug FFmpeg to help somebody with another discussion. But no luck until now:

  1. I have installed MSYS2, VSCode, ... following this tutorial. Btw if anybody ever wants to reproduce it, you will to install other tools also (gcc compiler ...): I have logged an issue for that.
  2. This way I was able to build a debug version of FFmpeg on my Windows 10 portable. And that part is ok, since I can start FFmpeg from Visual Studio Code and launch the Main method in the debugger.
  3. But to be able to debug the stdin/stdout/stderr streams I need to spawn an FFmegg process from a NodeJs application (i.e. Node-RED) and attach Visual Studio to that running FFmpeg process.
  4. So I had to install NodeJs (and Npm) extra on my MSYS2. Have done (on my 64 bit environment) that using:
    pacman -S mingw-w64-x86_64-nodejs
    
    And NodeJs seems to be installed correctly, because I can ask NodeJs which version it has:
    image
  5. Then I have installed Node-RED using:
    cd ~
    npm install node-red
    
    Which installs all the files I would expect (remark: the entire filesystem is available under c:\msys64):
    image
  6. But then I try to run Node-RED but nothing happens (i.e. it logs nothing and the prompt just appears again):
    cd ~/node_modules/node-red
    node  node-red/red.js
    
    This also doesn't work:
    node  /home/admin/node_modules/node-red/red.js
    

Remark 1: I had done the same yesterday and then Node-RED started normally (after adding --userDir /home/admin/node_modules/node-red because Node-RED seems not to be installed in the correct directory). But then I had issues (with shared libraries?) so I have uninstalled Msys2 and done everything all over again. And now it doesn't respond...

Remark 2: when I change e.g. red.js to redxx.js then NodeJs detects that the file doesn't exist:
image
So I assume I'm always there ...

Thanks !!
Bart

OK, firstly, do you know that if you are using Windows 10, you can have a command-line version of Ubuntu natively? You can install it from the Windows Store. Really not much need to mess with MSYS.

Next. Personally, I would install node-red into a folder rather than at the root of your home folder. This is how I always install it anyway. Then I use npm run scripts to start, stop, update, etc.

OK, with that out of the way. I'm not too sure what is going wrong here. But here is how I would start:

cd ~
mkdir nr
cd nr
npm init -y
npm install node-red node-red-admin --save  --unsafe-perm
mkdir data
node node_modules/node-red/red.js --userDir ./data

Here is an example package.json file from my own dev PC:

{
  "name": "node-red-master",
  "version": "0.20.0-beta.3",
  "description": "Test environment for developing Node-RED flows",
  "main": "node_modules/node-red/red.js",
  "scripts": {
    "start": "node node_modules/node-red/red.js --userDir ./data",
    "update": "npm install --unsafe-perm node-red node-red-admin",
    "check": "npm outdated",
    "check-data": "cd data && npm outdated",
    "update-data": "cd data && npm update",
    "check-master": "npm outdated",
    "update-master": "npm update",
    "admin": "node node_modules/node-red-admin/node-red-admin.js",
    "adminui": "start http://localhost:1880/red/",
    "ui": "start http://localhost:1880/ui/",
    "log": "sudo journalctl -u nrlive -f -n 0 -o cat"
  },
  "keywords": [
    "node-red"
  ],
  "author": "Julian Knight",
  "license": "MIT",
  "dependencies": {
    "node-red": "^0.20.0-beta.3",
    "node-red-admin": "^0.1.5"
  }
}

Obviously, there are a couple of scripts in there that only work on native Linux & a couple that only work on Windows.

I've documented this a bit better here:

Don't know if this will help with your problem I'm afraid. If it doesn't, I'd give the W10 native Ubuntu a go. Don't forget to also install build-essentials.

Hey Julian (@TotallyInformation),
Indeed those commands don't solve my problem...
To make a long story short, seems that for some reason the bcrypt library cannot be loaded on MSYS2 (since that library is installed):

image

I have no idea why the catch is not executed :roll_eyes: Very weird!

But since I had waste too much time, I switched to Ubuntu on Windows 10. And 5 minutes ago, finally I was able to spawn an FFmpeg process from Node-RED, and connect a debugger to that running process. Now I can at least step through the FFmeg's C-code. Haleluja. Thank a lot for the tip!!!! Ubuntu is very well integrated into Windows 10.

Wasted a lot of hours running a massive amount of linux commands, and tomorrow evening I have to start digging into FFmpeg to figure out why the image data is not handled on the fly. I'm on the edge of a Node-RED hobbyist burn-out ...

Ah, great. Glad that's worked out. Yes, Microsoft have actually done a decent job with the Linux subsystem. Of course, this isn't the first time they've done something like this. But it is the first time they've made it mainstream. Back in NT days, they did something similar but only marketed it as something to help people migrate from Linux to Windows! NT has always had the capability of parallel running alternative subsystems and it works pretty well.

Haha, though I like Linux, this has always been an issue that I've found.