Node-RED 0.20.0-beta.4 released

Possible issue?

I created a new, vanilla installation (On Windows 10) by:

  1. Create a new folder & cd into it.
  2. npm init -y
  3. `npm install --unsafe-perm node-red@next
  4. mkdir data
  5. Start NR using: node node_modules/node-red/red.js --userDir ./data
  6. Install a node using palete manager
  7. Create a very simple flow
  8. Do a Full Deploy
  9. Stop Node-RED

Then I noticed that I should have a file ./data/settings.js (since ./data is my userDir).

However, it isn't there & has to be created manually. Though Node-RED runs without it, I'm always given the projects prompt if I reload the admin interface.

Hi @Steve-Mcl

I'm not aware Projects weren't working on Windows.

What version of git have you got? git --version

I'm not able to recreate that on my Mac - I see the settings file correctly copied over.

When NR starts, what does it log for the settings file path?

Does ./data contain anything after starting NR?

Hi Nick, the ./data folder is empty when I first start at number 5. Here is the log

λ  npm start

> nr-vntest@0.0.1 start C:\src\nr-vtest
> node node_modules/node-red/red.js --userDir ./data

Running in undefined mode
3 Feb 22:26:03 - [info]

Welcome to Node-RED
===================

3 Feb 22:26:03 - [info] Node-RED version: v0.20.0-beta.4
3 Feb 22:26:03 - [info] Node.js  version: v8.12.0
3 Feb 22:26:03 - [info] Windows_NT 10.0.17763 x64 LE
3 Feb 22:26:04 - [info] Loading palette nodes
3 Feb 22:26:05 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
3 Feb 22:26:06 - [info] Settings file  : \Users\julia\.node-red\settings.js
3 Feb 22:26:06 - [info] HTTP Static    : C:\src\nr-vtest\public
3 Feb 22:26:06 - [info] Context store  : 'default' [module=memory]
3 Feb 22:26:06 - [info] User directory : C:\src\nr-vtest\data
3 Feb 22:26:06 - [warn] No active project : using default flows file
3 Feb 22:26:06 - [info] Flows file     : C:\src\nr-vtest\data\flows_DESKTOP-M1M6R28.json
3 Feb 22:26:06 - [info] Creating new flow file
3 Feb 22:26:06 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

3 Feb 22:26:06 - [info] Server now running at http://127.0.0.1:1880/red/
3 Feb 22:26:06 - [info] Starting flows
3 Feb 22:26:06 - [info] Started flows

Haha! I can see now that it has picked up the settings.js file from the default userDir location at ~/.node-red. That explains another issue that I was seeing with uibuilder which was using the uibuilder settings from that file. I hadn't noticed that previously.

I assume that it should have created a new settings.js file by copying the master from the location I was running from. Note that I don't have a copy of node-red installed globally but I do have a ~/.node-red folder - bit of an edge-case I'll admit.

Here is the file/folder structure after the first run of Node-RED (before any custom nodes installed or any flows created):

image

I see you are using npm start - that wasn't in your original steps to recreate. What exactly have you got in your package.json file for that?

It says at the start of the output I shared, all npm start does is run node node_modules/node-red/red.js --userDir ./data

I was hoping you'd share exactly what you have got in your package.json file for that.

Just to remove any possibility of misunderstanding or mistake on my part whilst trying to recreate.

No problem:

{
  "name": "nr-vntest",
  "version": "0.0.1",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "node node_modules/node-red/red.js --userDir ./data",
    "inspect": "node --inspect 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": [],
  "author": "Julian Knight (https://github.com/TotallyInformation)",
  "license": "Apache-2.0",
  "dependencies": {
    "node-red": "^0.20.0-beta.4"
  }
}

The scripts are ones I use as standard but I only used the npm start. The effect is the same if you run the command manually.

On Server 2012 -
git version 2.18.0.windows.1

On Windows 10 -
git version 2.15.0.windows.1

Log from Win 10 device running NR beta2, node V10.12.0, NPM V6.4.1 ...

4 Feb 13:59:03 - [debug] git -c credential.helper= push -u origin HEAD:master --porcelain
4 Feb 13:59:05 - [debug] [err] bash: /dev/tty: No such device or address
4 Feb 13:59:05 - [debug] [err] error: failed to execute prompt script (exit code 1)
4 Feb 13:59:05 - [debug] [err] fatal: could not read Username for 'http://xxxxxxxxx': No error
4 Feb 13:59:05 - [debug] rc=128

NOTES:

  • git is in path (accessible from any dir)
  • bash is in path (accessible from any dir)
  • git is accessible from in bash also.

So far, from multiple machines, multiple node & NR version, different git installs, I have never gotten this to work unfortunately.

Hi, just to add to your heads up. I tried to activate a remote git today (just to contribute with your investigation). I got the same results. I was able to push the local repository only via the command line. For whatever I try from Node-RED interface I keep being asking to enter the login information for github (I am pretty sure it was correct, as well as the SSH keys).

My environment:

4 Feb 11:26:57 - [info] Node-RED version: v0.20.0-beta.3
4 Feb 11:26:57 - [info] Node.js version: v8.11.1
4 Feb 11:26:57 - [info] Windows_NT 10.0.17763 x64 LE

$ npm -v
5.6.0

$ git --version
git version 2.16.1.windows.1

Thanks for the back up.

I forgot to mention I tried with SSH key also - similar results to you.

With http instead of SSH I get different (but still unsuccessful) results.

Potentially something to do with stdout / tty on windows?

Thanks @Steve-Mcl @Andrei and @TotallyInformation

I doubt I'll be able to make any progress on this without direct access to a Windows 10 machine. If anyone else is so inclined to delve into the code to help figure this out, I'd be happy to give an intro on slack to the moving pieces that are supposed to make this work.

Bit short on time to delve down to those depths right now unfortunately.

If I get some time, I'll try the same setup on a Pi to see if the same thing happens there.

I'd expect that to work; the unix-like systems are much more consistent in behaviour in how to spawn commands and the way git's credential helper stuff works. I was already aware that Window's has some quirks in this area and I thought I was handling them - but clearly not.

I decided to record a small video to show the issue. In the movie, I leave the dev tools opened to capture any eventual errors in the browser. When I try to push the local repository to github I can see that the issue starts even before I enter the username/password. Note: The issue is not particular to Chrome. Same happens on Edge and IE.

Click to watch

@Andrei this is nothing to do with the browser. It is 100% related to how we pass credentials to git - it is a complicated process that involves multiple scripts and environment variables properly configured to tell git about those scripts. I can see there are github issues (some open, some closed) against other projects who do similar interactions with Git. But until I can get access to a Windows machine there's not much I can do to investigate.

@knolleary I would investigate but not sure where to start tbh.
I have managed to debug own nodes but when trying to debug anything in node-red, it's a labyrinth.

Is there any update on this issue? I have the same problem on node-red v1.0.6
described it in this topic: https://discourse.nodered.org/t/projects-feature-authentication-problem/22877/20?u=psmtvdw

As you have re-raised it in another thread we'll close this one.

1 Like