Node-red-nodegen Help


#1

Hello Chaps.
I have been trying to get this Npm to work but not having to much look

Using Example 2
Example 2. Create original node from function node (JavaScript code)

  1. On Node-RED flow editor, save function node to library with file name (lower-case.js).
  2. node-red-nodegen ~/.node-red/lib/function/lower-case.js
    
  3. cd node-red-contrib-lower-case
    
  4. sudo npm link
    
  5. cd ~/.node-red
    
  6. npm link node-red-contrib-lower-case
    
  7. node-red
    

-> You can use lower-case node on Node-RED flow editor.

I get to step 2. CMD shows an error :
C:\Users\daniel.smith>node-red-nodegen ~/.node-red/lib/function/lower-case.js
Error: ENOENT: no such file or directory, open 'C:\Users\daniel.smith~.node-red\lib\function\lower-case.js'
at Object.fs.openSync (fs.js:652:18)
at Object.fs.readFileSync (fs.js:553:33)
at Object. (C:\Users\daniel.smith\AppData\Roaming\npm\node_modules\node-red-nodegen\bin\node-red-nodegen.js:122:27)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)

I know for certain the path exists i can CD into it. Would anyone have any ideas on how im making this mistake ?

Using.
Windows 7
Latest Npm
Lastest nodeJs
Latest Node red
Chrome Browser.

Thanks in advance


#2

Try using the full path to the file instead of ~/

Or maybe try in powershell


#3

I did that and it didn't execute the app. it just said not recognise command.

When i follow hi method i get the log it pasted in the first post. I also checked the directories it supposedly generates the Npm package and they was empty.

Dan


#4

I meant

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

#5

I meant that to. I typed exactly what you have typed, comes up with that same error.


#6

Error: ENOENT: no such file or directory

If you navigate to the folder C:\Users\daniel.smith\.node-red\lib\function\ do you have the lower-case.js in place?
I think the path is there just as an example and you should point the the nodegen to the real file you need it to work on.


#7

Had word from author .
Separator is wrong as I'm not using UNIX . Had to change for Windows.
I'll let you know if it works !


#8

Don't forget to escape back-slashes if putting the path in a string. C:\\Users\\daniel.smith\\.node-red\\lib\\function\\. Forward slashes work as well though on Windows so best to stick to those.

Ideally, you would use the NodeJS standard library function for path joins as that is much better at taking care of things but it means importing it.