# Could not locate the bindings file

**URL:** <https://discourse.nodered.org/t/could-not-locate-the-bindings-file/12258>\
**Category:** General\
**Created:** [15 June 2019 11:20 UTC](https://discourse.nodered.org/t/could-not-locate-the-bindings-file/12258 "2019-06-15T11:20:54Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![msupra](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/msupra/32/34760_2.png) [@msupra](https://discourse.nodered.org/u/msupra)\
**Post date:** [15 June 2019 11:20 UTC](https://discourse.nodered.org/t/could-not-locate-the-bindings-file/12258/1 "2019-06-15T11:20:54Z")

</div>

Hi all

I followed the online tutorial to create your first node. It worked exactly as expected.

I then tried to create my own node and everything goes well until I try to use it within node-red. The only difference between the example and my code is, that I have a dependency on sensit-payload.

When I use the node, I get the following error:  
[error] [sensit-decoder:c6cbc5fe.014f18] Error: Could not locate the bindings file. Tried:.....

When I create a function within node-red with the sam function code in my node js file, It works fine, with no errors.

Can you maybe assist me in resolving the issue?

Regards  
Morne Supra

---

<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:** [15 June 2019 13:18 UTC](https://discourse.nodered.org/t/could-not-locate-the-bindings-file/12258/2 "2019-06-15T13:18:22Z")

</div>

It would help to give us the full error and also perhaps a pointer to your code on GitHub.

You will likely need to add some extra console.log statements to find out where in your code this is being triggered.

---

<div class="post-metadata">

**Author:** ![msupra](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/msupra/32/34760_2.png) [@msupra](https://discourse.nodered.org/u/msupra)\
**Post date:** [15 June 2019 14:27 UTC](https://discourse.nodered.org/t/could-not-locate-the-bindings-file/12258/3 "2019-06-15T14:27:07Z")

</div>

Hi all. Please find the error below and the git repo, [bitbucket.org](http://bitbucket.org):supragroup/sensit-decode.git:  
0|integrem | 15 Jun 09:44:57 - [error] [sensit-decoder:7bdcbd87.7800e4] Error: Could not locate the bindings file. Tried:  
0|integrem | → /root/sensit-decoder/node\_modules/sensit-payload/build/sensit\_payload\_lib.node  
0|integrem | → /root/sensit-decoder/node\_modules/sensit-payload/build/Debug/sensit\_payload\_lib.node  
0|integrem | → /root/sensit-decoder/node\_modules/sensit-payload/build/Release/sensit\_payload\_lib.node  
0|integrem | → /root/sensit-decoder/node\_modules/sensit-payload/out/Debug/sensit\_payload\_lib.node  
0|integrem | → /root/sensit-decoder/node\_modules/sensit-payload/Debug/sensit\_payload\_lib.node  
0|integrem | → /root/sensit-decoder/node\_modules/sensit-payload/out/Release/sensit\_payload\_lib.node  
0|integrem | → /root/sensit-decoder/node\_modules/sensit-payload/Release/sensit\_payload\_lib.node  
0|integrem | → /root/sensit-decoder/node\_modules/sensit-payload/build/default/sensit\_payload\_lib.node  
0|integrem | → /root/sensit-decoder/node\_modules/sensit-payload/compiled/8.16.0/linux/x64/sensit\_payload\_lib.node  
0|integrem | → /root/sensit-decoder/node\_modules/sensit-payload/addon-build/release/install-root/sensit\_payload\_lib.node  
0|integrem | → /root/sensit-decoder/node\_modules/sensit-payload/addon-build/debug/install-root/sensit\_payload\_lib.node  
0|integrem | → /root/sensit-decoder/node\_modules/sensit-payload/addon-build/default/install-root/sensit\_payload\_lib.node  
0|integrem | → /root/sensit-decoder/node\_modules/sensit-payload/lib/binding/node-v57-linux-x64/sensit\_payload\_lib.node

Regards  
Morne

---

<div class="post-metadata">

**Author:** ![msupra](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/msupra/32/34760_2.png) [@msupra](https://discourse.nodered.org/u/msupra)\
**Post date:** [15 June 2019 14:32 UTC](https://discourse.nodered.org/t/could-not-locate-the-bindings-file/12258/4 "2019-06-15T14:32:14Z")

</div>

Hi  
Update on git repo:  
[https://bitbucket.org/supragroup/sensit-decode/src/master/](https://bitbucket.org/supragroup/sensit-decode/src/master/)

---

<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:** [15 June 2019 18:05 UTC](https://discourse.nodered.org/t/could-not-locate-the-bindings-file/12258/5 "2019-06-15T18:05:02Z")

</div>

There would appear to be some errors in this code:

```auto
module.exports = function(RED) {
    function SensitDecoderNode(config) {
        RED.nodes.createNode(this,config);
        var node = this;
        node.on('input', function(msg) {
	    const sensitPayload = require('sensit-payload');
            msg.payload = sensitPayload.parse(msg.payload);
            node.send(msg);
        });
    }
    RED.nodes.registerType("sensit-decoder",SensitDecoderNode);
}

```

For 1, you shouldn't put a "require" in the middle of your code. It should go at the top. Indeed, it should go outside the module.exports.

Then the code indentation makes it hard to follow.

Finally, this error is a problem with the 'sensit-payload' package as far as I can tell.

---

<div class="post-metadata">

**Author:** ![msupra](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/msupra/32/34760_2.png) [@msupra](https://discourse.nodered.org/u/msupra)\
**Post date:** [15 June 2019 19:24 UTC](https://discourse.nodered.org/t/could-not-locate-the-bindings-file/12258/6 "2019-06-15T19:24:00Z")

</div>

Hi @TotallyInformation. I moved the require to outside the module.exports, but then the node won't register.

When I place it after RED.nodes.createNode(), I get no errors, but also no response:  
module.exports = function(RED) {  
function SensitDecoderNode(config) {  
RED.nodes.createNode(this,config);  
const sensitPayload = require('sensit-payload');  
var node = this;  
node.on('input', function(msg) {  
msg.payload = sensitPayload.parse(msg.payload);  
node.send(msg);  
});  
}  
RED.nodes.registerType("sensit-decoder",SensitDecoderNode);  
}

When I remove it completely, as expected, I get "ReferenceError: sensitPayload is not defined" inside node-red debug.

When I use the sensit-payload package within a function inside node-red, it works fine.

I am definitely not an expert developer and this is my first attempt at trying to write a node, so it is a learning curve for me.

Regards  
Morne

---

<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:** [15 June 2019 23:22 UTC](https://discourse.nodered.org/t/could-not-locate-the-bindings-file/12258/7 "2019-06-15T23:22:18Z")

</div>

Please wrap code in back-ticks so that it is more easily read.

```auto
const sensitPayload = require('sensit-payload');

module.exports = function(RED) {
    function SensitDecoderNode(config) {
        RED.nodes.createNode(this,config);

        var node = this;

        node.on('input', function(msg) {
            msg.payload = sensitPayload.parse(msg.payload);
            node.send(msg);
        });
    }

    RED.nodes.registerType("sensit-decoder",SensitDecoderNode);
}

```

The above should work as long as `sensitPayload.parse(msg.payload)` is valid.

As I said before, I think this is an issue with 'sensit-payload'.

If you look at my node-red-contrib-uibuilder node, especially the v2 branch you should see that I've used the structure above and it works just fine.

I would also recommend using a code editor with ESLint or JSLint to help you with the layout of your code and avoid mixing quote types as the above code does (' and "). While this isn't an error, it is harder to read which makes identifying errors harder.

---

<div class="post-metadata">

**Author:** ![msupra](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/msupra/32/34760_2.png) [@msupra](https://discourse.nodered.org/u/msupra)\
**Post date:** [16 June 2019 07:45 UTC](https://discourse.nodered.org/t/could-not-locate-the-bindings-file/12258/8 "2019-06-16T07:45:15Z")

</div>

@TotallyInformation, thank you very much for your assistance, patience and guidance.

It looks like there might be an issue with sensit-payload, as it is still not working.

I will try creating a node with another package.

Regards  
Morne

---

<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:** [16 June 2019 10:16 UTC](https://discourse.nodered.org/t/could-not-locate-the-bindings-file/12258/9 "2019-06-16T10:16:39Z")

</div>

> [@msupra](#):
>
> sensit-payload

A quick look at the code shows me that the bindings file is a C library that installing the package should automatically create for you.

I'm thinking that you either didn't completely install the package or it is installed in the wrong place.

Does your node's package.json include a reference to sensit-payload and did you run `npm install` to get it installed? Did you get any errors from the compilation?

Might be best to delete the package folder and start again.

---

<div class="post-metadata">

**Author:** ![msupra](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/msupra/32/34760_2.png) [@msupra](https://discourse.nodered.org/u/msupra)\
**Post date:** [16 June 2019 10:36 UTC](https://discourse.nodered.org/t/could-not-locate-the-bindings-file/12258/10 "2019-06-16T10:36:16Z")

</div>

Hi @TotallyInformation. After I replied earlier, I actually went back to my nodered directory and did a manual install of sensit-payload via npm. After that the node worked as expected.

There is a reference in the package.json, but I suspect somewhere along the line, the package did not install properly.

Thanks for all your help.

Regards  
Morne
