# Tradfri in Node RED on Windows (coap library)

**URL:** <https://discourse.nodered.org/t/tradfri-in-node-red-on-windows-coap-library/6416>\
**Category:** General\
**Tags:** windows\
**Created:** [5 January 2019 09:17 UTC](https://discourse.nodered.org/t/tradfri-in-node-red-on-windows-coap-library/6416 "2019-01-05T09:17:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Michael](https://discourse.nodered.org/u/Michael)\
**Post date:** [5 January 2019 09:17 UTC](https://discourse.nodered.org/t/tradfri-in-node-red-on-windows-coap-library/6416/1 "2019-01-05T09:17:11Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [5 January 2019 09:25 UTC](https://discourse.nodered.org/t/tradfri-in-node-red-on-windows-coap-library/6416/2 "2019-01-05T09:25:33Z")

</div>

Have you tried the other tradfri contrib node?

---

<div class="post-metadata">

**Author:** ![Michael](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Michael](https://discourse.nodered.org/u/Michael)\
**Post date:** [5 January 2019 09:34 UTC](https://discourse.nodered.org/t/tradfri-in-node-red-on-windows-coap-library/6416/3 "2019-01-05T09:34:49Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [5 January 2019 12:05 UTC](https://discourse.nodered.org/t/tradfri-in-node-red-on-windows-coap-library/6416/4 "2019-01-05T12:05:49Z")

</div>

> [@Michael](#):
>
> node-aead-crypto@1.1.6

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.

---

<div class="post-metadata">

**Author:** ![Michael](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Michael](https://discourse.nodered.org/u/Michael)\
**Post date:** [5 January 2019 13:48 UTC](https://discourse.nodered.org/t/tradfri-in-node-red-on-windows-coap-library/6416/5 "2019-01-05T13:48:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [5 January 2019 13:52 UTC](https://discourse.nodered.org/t/tradfri-in-node-red-on-windows-coap-library/6416/6 "2019-01-05T13:52:08Z")

</div>

Please read the docs on Node-RED install on Windows

[https://nodered.org/docs/platforms/windows](https://nodered.org/docs/platforms/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.

---

<div class="post-metadata">

**Author:** ![Michael](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Michael](https://discourse.nodered.org/u/Michael)\
**Post date:** [5 January 2019 16:15 UTC](https://discourse.nodered.org/t/tradfri-in-node-red-on-windows-coap-library/6416/7 "2019-01-05T16:15:20Z")

</div>

Hi  
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)

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

```

and

```auto
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\Michael.windows-build-tools\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

---

<div class="post-metadata">

**Author:** ![Michael](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Michael](https://discourse.nodered.org/u/Michael)\
**Post date:** [5 January 2019 16:32 UTC](https://discourse.nodered.org/t/tradfri-in-node-red-on-windows-coap-library/6416/8 "2019-01-05T16:32:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [6 January 2019 01:40 UTC](https://discourse.nodered.org/t/tradfri-in-node-red-on-windows-coap-library/6416/9 "2019-01-06T01:40:20Z")

</div>

> [@Michael](#):
>
> C:\Users\Michael.windows-build-tools\python27\python.exe

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

```auto
C:\Users\Michael\.windows-build-tools\python27\python.exe

```

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

```
C:\Users\Michael\.windows-build-tools\python27\

```

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

```
> python --version

```

You should get

```
Python 2.7.14

```

back.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [6 January 2019 01:42 UTC](https://discourse.nodered.org/t/tradfri-in-node-red-on-windows-coap-library/6416/10 "2019-01-06T01:42:27Z")

</div>

> [@Michael](#):
>
> is there a way to manually compile the libcoap with the npm build tools ?

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.
