Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

node.stop() is thrwing the libp2p node not started error #841

Closed
grsind19 opened this issue May 4, 2017 · 2 comments
Closed

node.stop() is thrwing the libp2p node not started error #841

grsind19 opened this issue May 4, 2017 · 2 comments
Labels
kind/bug A bug in existing code (including security flaws)

Comments

@grsind19
Copy link

grsind19 commented May 4, 2017

Installed the ipfs node module locally

then wrote this code,

const IPFS = require('ipfs')

const node = new IPFS();

node.on('ready', () => {
  // Your now is ready to use \o/
  console.log("node is ready")
  // stopping a node
  node.stop(() => {
    console.log("node is now 'offline'");	
  })
})

After running the code, getting the below error

Ins:nodeipfs insmobility$ node ipfs.js 
Swarm listening on /ip4/127.0.0.1/tcp/4003/ws/ipfs/QmdVzXoFxNJbQ3pR3TvWFuHP2KGEpyL3z7339G98VQhAVy
Swarm listening on /ip4/127.0.0.1/tcp/4002/ipfs/QmdVzXoFxNJbQ3pR3TvWFuHP2KGEpyL3z7339G98VQhAVy
Swarm listening on /ip4/192.168.1.15/tcp/4002/ipfs/QmdVzXoFxNJbQ3pR3TvWFuHP2KGEpyL3z7339G98VQhAVy
node is ready

assert.js:85
  throw new assert.AssertionError({
  ^
AssertionError: The libp2p node is not started yet
    at Node.dialByPeerInfo (/Users/insmobility/seethadev/blockchain/ipfsleaning/nodeipfs/node_modules/libp2p/src/index.js:219:5)
    at EventEmitter.self._libp2pNode.discovery.on (/Users/insmobility/seethadev/blockchain/ipfsleaning/nodeipfs/node_modules/ipfs/src/core/components/libp2p.js:37:32)
    at emitOne (events.js:96:13)
    at EventEmitter.emit (events.js:188:7)
    at Railing.discovery.on (/Users/insmobility/seethadev/blockchain/ipfsleaning/nodeipfs/node_modules/libp2p/src/index.js:70:26)
    at emitOne (events.js:96:13)
    at Railing.emit (events.js:188:7)
    at PeerInfo.create (/Users/insmobility/seethadev/blockchain/ipfsleaning/nodeipfs/node_modules/libp2p-railing/src/index.js:52:16)
    at Function.PeerInfo.create (/Users/insmobility/seethadev/blockchain/ipfsleaning/nodeipfs/node_modules/peer-info/src/index.js:115:3)
    at bootstrapers.forEach.e (/Users/insmobility/seethadev/blockchain/ipfsleaning/nodeipfs/node_modules/libp2p-railing/src/index.js:45:18)

can someone explain this.

@daviddias daviddias added the kind/bug A bug in existing code (including security flaws) label May 7, 2017
@daviddias
Copy link
Member

That is indeed mysterious, we have a bunch of tests that checks exactly that case in https://github.com/ipfs/js-ipfs/blob/master/test/core/create-node.spec.js

Could you check which version you are using?

@daviddias daviddias added the status/deferred Conscious decision to pause or backlog label Jul 3, 2017
@daviddias
Copy link
Member

The issue behind this was fixed. Let me know if you still experience otherwise @grsind19.

Closing, I'll reopen if necessary :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug A bug in existing code (including security flaws)
Projects
None yet
Development

No branches or pull requests

2 participants