Azusfin / lavacoffee

A fast and rich-featured lavalink wrapper for node.js
https://Azusfin.github.io/lavacoffee/index.html
BSD 3-Clause "New" or "Revised" License
7 stars 2 forks source link

error when i run bot #3

Closed kabirjaipal closed 2 years ago

kabirjaipal commented 2 years ago


D:\Programing\coding\My Code\YOUTUBE TUTORIALS\Lavalink Music>node .
node:internal/modules/cjs/loader:488
      throw e;
      ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/utils' is not defined by "exports" in D:\Programing\coding\My Code\YOUTUBE TUTORIALS\Lavalink Music\node_modules\lavacoffee\package.json
    at new NodeError (node:internal/errors:371:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:429:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:683:3)
    at resolveExports (node:internal/modules/cjs/loader:482:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (D:\Programing\coding\My Code\YOUTUBE TUTORIALS\Lavalink Music\index.js:6:23) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Node.js v17.1.0```

fix this and give example how to connect a node
Azusfin commented 2 years ago

Apparently https://github.com/Azusfin/lavacoffee/commit/6bbe0a45d661f3ea13767d97d47e44d8c5fee843 break some codes that tries to import dist/utils, it should be changed to using Utils ex. from

const Utils = require("lavacoffee/dist/utils")

to

const { Utils } = require("lavacoffee")
Azusfin commented 2 years ago

example how to connect a node

lava.add({
  name: "LAVA-MAIN-1",
  url: "<your lavalink server url>",
  password: "<your lavalink server password>",
  secure: false // whether the server allow secure protocol or not (when set to true, it will use wss and https instead of ws and http)
})

basic usage: lava.add(NodeOptions) with lava.init("<bot id>") need to be called once the bot is ready

Azusfin commented 2 years ago

Apparently 6bbe0a4 break some codes that tries to import dist/utils, it should be changed to using Utils ex. from

const Utils = require("lavacoffee/dist/utils")

to

const { Utils } = require("lavacoffee")

you can also keep old code because it was fixed in https://github.com/Azusfin/lavacoffee/releases/tag/v1.5.1

Azusfin commented 2 years ago

Closed for 7 days of inactivity