Open fabriziogianni7 opened 2 years ago
referencing this issue from ipfs repo -- > https://github.com/ipfs/js-ipfs/issues/4139
changing my file this way:
newpieceplease_v2
// i just need it in nodejs so don't care about browser part
export default class NewPiecePlease {
constructor(Ipfs, OrbitDB) {
this.OrbitDB = OrbitDB
this.Ipfs = Ipfs
}
async create() {
this.node = await this.Ipfs.create({
preload: { enabled: false },
repo: './ipfs',
EXPERIMENTAL: { pubsub: true },
config: {
Bootstrap: [],
Addresses: { Swarm: [] }
}
})
this._init()
}
async _init() {
this.orbitdb = await this.OrbitDB.createInstance(this.node)
this.defaultOptions = {
accessController: {
write: [this.orbitdb.identity.id]
}
}
if (this.onready) this.onready();
}
}
main.js:
iimport NewPiecePlease from './newpieceplease_v2.js'
import * as Ipfs from 'ipfs'
import OrbitDB from 'orbit-db'
const main = async () => {
try {
const NPP = new NewPiecePlease(Ipfs, OrbitDB)
await NPP.create()
NPP.onready = () => console.log(NPP.orbitdb.identity.id)
} catch (error) {
console.log(error)
}
}
main()
let me know any thought thanks !
Hi, I'm using node v16, following the 1sts steps of the tutorial got this error:
my files: newpieceplease.js
main.js