Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in package.json #179

@fabriziogianni7

Description

@fabriziogianni7

Hi,
I'm using node v16,
following the 1sts steps of the tutorial
got this error:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/fabri/keyko/orbit/node_modules/ipfs/package.json

my files:
newpieceplease.js

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();
  }
}

try {
    // console.log('in try')
    const Ipfs = require('ipfs')
    const OrbitDB = require('orbit-db')

    module.exports = exports = new NewPiecePlease(Ipfs, OrbitDB)
} catch (e) {
    console.log(e)
    // window.NPP = new NewPiecePlease(window.Ipfs, window.OrbitDB)
}

main.js

const NPP = require('./newpieceplease') 

const main = async () => {
console.log(NPP)

}

main()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions