ipfs / js-ipfs

IPFS implementation in JavaScript
https://js.ipfs.tech
Other
7.43k stars 1.25k forks source link

can't start ipfs-daemon #4334

Closed mtiger2k closed 1 year ago

mtiger2k commented 1 year ago

I want to start my own daemon with api with the following: ` import { Daemon } from 'ipfs-daemon';

const print = (msg) => console.log(msg); async function startServer() { let config = { Addresses: { Swarm: [ '/ip4/0.0.0.0/tcp/4002', '/ip4/0.0.0.0/tcp/4003/ws', ], API: '/ip4/0.0.0.0/tcp/5002', Gateway: '/ip4/0.0.0.0/tcp/9090', RPC: '/ip4/127.0.0.1/tcp/5003', Announce: [], }, }; const daemon = new Daemon({ config, repo: './jsipfs', });

try { await daemon.start();

const version = await daemon._ipfs.version();

print(`js-ipfs version: ${version.version}`);

} catch (/* @type {any} / err) { if (err.code === 'ERR_REPO_NOT_INITIALIZED' || err.message.match(/uninitialized/i)) { err.message = 'no initialized ipfs repo found in ' + 'jsipfs' + '\nplease run: jsipfs init'; } throw err; }

print('Daemon is ready');

const cleanup = async () => { print('Received interrupt signal, shutting down...'); await daemon.stop(); process.exit(0); };

// listen for graceful termination process.on('SIGTERM', cleanup); process.on('SIGINT', cleanup); process.on('SIGHUP', cleanup);

}

startServer(); ` using latest ipfs-daemon 0.16.0

but got the following error: file:///Users/tiansha/ipfs/ipfs-daemon/node_modules/@achingbrain/ssdp/dist/src/commands/notify.js:14 resolveService(ssdp, message.USN, message.NT, message.LOCATION, message.ttl())

TypeError: message.ttl is not a function at notify (file:///Users/tiansha/ipfs/ipfs-daemon/node_modules/@achingbrain/ssdp/dist/src/commands/notify.js:14:77) at SSDPImpl.emit (node:events:513:28) at parseSsdpMessage (file:///Users/tiansha/ipfs/ipfs-daemon/node_modules/@achingbrain/ssdp/dist/src/parse-ssdp-message.js:38:10) at SSDPImpl.emit (node:events:513:28) at Socket. (file:///Users/tiansha/ipfs/ipfs-daemon/node_modules/@achingbrain/ssdp/dist/src/create-sockets.js:10:22) at Socket.emit (node:events:513:28) at UDP.onMessage [as onmessage] (node:dgram:933:8)

and I tried node 16, 18, with the same error.

mtiger2k commented 1 year ago

it's @achingbrain/ssdp issue, had submit it in the repo.