# Connecting IPTB: IPFS daemon to js-ipfs node

**URL:** <https://discuss.ipfs.tech/t/connecting-iptb-ipfs-daemon-to-js-ipfs-node/1267>\
**Category:** Uncategorized\
**Created:** [October 13, 2017, 4:58am UTC](https://discuss.ipfs.tech/t/connecting-iptb-ipfs-daemon-to-js-ipfs-node/1267 "2017-10-13T04:58:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![arby](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/arby/32/2435_2.png) [@arby](https://discuss.ipfs.tech/u/arby)\
**Post date:** [October 13, 2017, 4:58am UTC](https://discuss.ipfs.tech/t/connecting-iptb-ipfs-daemon-to-js-ipfs-node/1267/1 "2017-10-13T04:58:37Z")

</div>

On my console, I can pull up an IPFS test node with:

```
> iptb shell 0
> ipfs daemon
-- Initializing daemon...
-- Swarm listening on /ip4/127.0.0.1/tcp/55269

```

However, when I attempt to connect to it through node.js (on the same machine):

```
const IPFS = require('ipfs')
const node = new IPFS()
node.on('ready', () => {
    node.swarm.connect('/ip4/127.0.0.1/tcp/55269', err => {
        if (err) console.log(err)
    })
})

```

I’m getting an error `if (string.length === 0) return Buffer.allocUnsafe(0)`  
`TypeError: Cannot read property 'length' of null`

I get the same error if I try to connect to `/ip4/127.0.0.1/tcp/55269/ipfs/[PEER_ID]`, but I see an error reported on my daemon console `error reading rpc from <peer.ID PQoKLK>: stream reset comm.go:36`. Changing the address to the /p2p-circuit/… address gives me the error `Error: No available transport to dial to`

How do I go about establishing a tiny private network between my Node.js node and my dev Testbed (then eventually, other machines on my network) ? If I don’t want any outside connections, would I need something in the configuration to prevent it from connecting to the entire IPFS network?

Edit: I removed the `.ipfs` and `.jsipfs` repos, re-initialized, dropped the bootstrap nodes, fired up a console daemon, and I’ve now got the two nodes speaking to each other on a small network. I also had to add a small delay on the javascript node between connecting to the swarm and issuing my first command – I couldn’t find a callback that would wait until the connection was fully ready.
