Tradfri in Node RED on Windows (coap library)


Hi i´m trying out if tradfri in connection with node red is a good option for my home.
I´ve got the tradfri gateway and some bulbs. For testing purposes I installed node red on my local windows PC.
Unfortunately i don´t get the connection to the gateway. Presumably it´s becaus of the coap library. They are onloy precompiled for debai raspian and osx. (in C:\Users\User1.node-red\node_modules\node-tradfri-argon\lib).
Is there a way the get this working on windows or do i need a raspian?



Have you tried the other tradfri contrib node?



there ist an error installing the other node
verbose cwd C:\Users\Michael.node-red
1452 verbose Windows_NT 10.0.17134
1453 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "--save" "--save-prefix=~" "--production" "node-red-contrib-node-tradfri@0.1.2"
1454 verbose node v8.15.0
1455 verbose npm v6.4.1
1456 error code ELIFECYCLE
1457 error errno 1
1458 error node-aead-crypto@1.1.6 install: node lib/install.js
1458 error Exit status 1
1459 error Failed at the node-aead-crypto@1.1.6 install script.
1459 error This is probably not a problem with npm. There is likely additional logging output above.
1460 verbose exit [ 1, true ]



Looks like the install of this dependency failed. I just tried installing that manually on my W10 dev PC and it worked fine. Do you have build-essentials installed? As with many Node.JS modules, there is a binary component in that module that has to be compiled.

Then I did a npm install node-red-contrib-node-tradfri and that worked fine as well.



is build essential a installation in node red (manage palette) or somewhere else? Sorry - I´m new to node red and couldn´t find this through a search.
I also tried node-ahead-crypto - there is no match in palette



Please read the docs on Node-RED install on Windows

node-ahead-crypto is a package used by the node you are trying to install with a successful install it is installed for you.

1 Like


thank yue very much for your support.

As far I understood I´ve forgotten the windows build tools.
I have installed them with the following commands (admin cmd)

npm install --global --production windows-build-tools


npm install --global --production --add-python-to-path windows-build-tools

i also restartet the system.
But the error while installing the other tradfri module occurs again. Here the output of the command line

node-aead-crypto@1.1.6 install:default C:\Users\Michael.node-red\node_modules\node-aead-crypto
node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for node-aead-crypto@1.1.6 and node@8.15.0 (node-v57 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error Remote end closed socket abruptly.
node-pre-gyp WARN Pre-built binaries not installable for node-aead-crypto@1.1.6 and node@8.15.0 (node-v57 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error ENOENT: Cannot cd into 'C:\Users\Michael.node-red\node_modules\node-aead-crypto\build\Release\node-v57-win32-x64'
gyp ERR! configure error
gyp ERR! stack Error: ENOENT: no such file or directory, open 'C:\Users\Michael.node-red\node_modules\node-aead-crypto\build\config.gypi'
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\Users\Michael\.node-red\node_modules\node-aead-crypto\build\Release\node-v57-win32-x64\node_aead_crypto.node" "--module_name=node_aead_crypto" "--module_path=C:\Users\Michael\.node-red\node_modules\node-aead-crypto\build\Release\node-v57-win32-x64" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v57" "--python=C:\Users\Michael\.windows-build-tools\python27\python.exe"
gyp ERR! cwd C:\Users\Michael.node-red\node_modules\node-aead-crypto
gyp ERR! node -v v8.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\Michael.node-red\node_modules\node-aead-crypto\build\Release\node-v57-win32-x64\node_aead_crypto.node --module_name=node_aead_crypto --module_path=C:\Users\Michael.node-red\node_modules\node-aead-crypto\build\Release\node-v57-win32-x64 --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57 --python=C:\Users\\python27\python.exe' (1)
node-pre-gyp ERR! stack at ChildProcess. (C:\Users\Michael.node-red\node_modules\node-aead-crypto\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:915:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Windows_NT 10.0.17134
node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\Michael\.node-red\node_modules\node-aead-crypto\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\Michael.node-red\node_modules\node-aead-crypto
node-pre-gyp ERR! node -v v8.15.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok



is there a way to manually compile the libcoap with the npm build tools ?



Not sure where that comes from but it doesn't look right. It should be:


Note the additional backslash. Can you check your PATH environment variable., it should contain:


and you should be able to run this from the command line:

> python --version

You should get

Python 2.7.14




This will happen automatically, you need to get the build stuff sorted or you will have all sorts of issues. This isn't a problem with a Node.JS module or Node-RED, it is an issue with your environment.