node-red/node-red-nodegen

Ubable to get this working using the function node method

smithtekIOT opened this issue · 7 comments

What are the steps to reproduce?

Follow the Example 2 instructions

What happens?

It produces an error on step 2 in the console

What do you expect to happen?

I don't know

Please tell us about your environment:

  • Node generator version: Latest
  • Node-RED version: Latest
  • node.js version: Latest
  • npm version: Latest
  • Platform/OS: Windows 7
  • Browser: Chrome

I'm still learning how to navigate and work with command line so i apologize if this is a dumb question.
I had followed your example 2, exported a function node from node red to a directory.
I then tried node-red-nodegen ~/.node-red/lib/function/lower-case.js

I get an error Error:ENOENT: no such file or directory, open C:\Users\daniel.smith/.node-red/lib/function/lower-case.js.node-red\lib\function.

I haven't been able to get any further.

Hope you can help.

Kind regards

Thank you for using Node generator.
Because the example is for Unix environments like macOS and Linux, the file separator is "/".
On Windows OS, the file separator is "\". Therefore, you need to replace the separators.
Could you try the following command?

node-red-nodegen C:\Users\daniel.smith\.node-red\lib\function\lower-case.js

Hello mate.
Apologies for delay, i have been on leave for a week.
I tired the command you advised and it still did not work.

I tried this
node-red-nodegen ~.node-red\lib\function\lower-case.js

This resulted in the same error

I then tried
node-red-nodegen C:\Users\daniel.smith.node-red\lib\function\lower-case.js

Result was,
Error: Type error cannot read property 'match' of undefined

Any suggestions ?

Thanks you

Your second command is correct. In my environment, node-red-nodegen command generated a node correctly as follows.

nodegencli

I think that the error occurred from the code.
https://github.com/node-red/node-red-nodegen/blob/0.0.2/lib/nodegen.js#L148

Therefore, the node name was not specified because of some reasons. I'd like to check that the file has name property.
Could you share your lower-case.js file?

Hello Sir.

I have attached the "lower-case.js" for your viewing. You said you think there is problem with code.

is this something that has been fixed ?

Thank you.

Dan

functions.zip

I have not changed the source code yet. It is the source code of Node generator v0.0.2 same as module published on npmjs.

Thank you for your sharing the lower-case.js file. I found the reason why you encountered the error. Your lower-case.js file is flow JSON data which contains function node. I think that you exported function node using "Export to clipboard" in the export menu on Node-RED flow editor.

Could you use "Save to Library" in function node to export it as lower-case.js file?

save2lib

Hello
I was exporting wrong, yes. I was exporting the whole function node to library.

So i copied the exact way you have shown and it still has the same error.

Here is the full path i used.
node-red-nodegen C:\Users\daniel.smith.node-red\lib\functions\lower-case.js

Here is the path to lower-case.js using

lower case issues

lower case issues 2

@ngservices Good! I'll close this issue.