Error started appearing randomly today

#1

Hello. I have a Discord bot hosted on Glitch. Everything was fine, but today it started showing that “node-fetch could not be found”. I found an article that was saying i would have to run “enable-pnpm”. I did that, and the bot now turns on, but then it shows this error:

/rbd/pnpm-volume/dd393cd1-6a2b-4414-a08c-33fb4f210cf7/node_modules/.github.com/discordjs/discord.js/32a432f4a55094ea7c0f6260529f8f911ea8a2de/node_modules/discord.js/src/client/websocket/WebSocketShard.js:171

    this.off(ShardEvents.CLOSE, onClose);

         ^


TypeError: this.off is not a function

at WebSocketShard.onReady (/rbd/pnpm-volume/dd393cd1-6a2b-4414-a08c-33fb4f210cf7/node_modules/.github.com/discordjs/discord.js/32a432f4a55094ea7c0f6260529f8f911ea8a2de/node_modules/discord.js/src/client/websocket/WebSocketShard.js:171:14)

at Object.onceWrapper (events.js:313:30)

at emitNone (events.js:111:20)

at WebSocketShard.emit (events.js:208:7)

at WebSocketShard.onPacket (/rbd/pnpm-volume/dd393cd1-6a2b-4414-a08c-33fb4f210cf7/node_modules/.github.com/discordjs/discord.js/32a432f4a55094ea7c0f6260529f8f911ea8a2de/node_modules/discord.js/src/client/websocket/WebSocketShard.js:339:14)

at WebSocketShard.onMessage (/rbd/pnpm-volume/dd393cd1-6a2b-4414-a08c-33fb4f210cf7/node_modules/.github.com/discordjs/discord.js/32a432f4a55094ea7c0f6260529f8f911ea8a2de/node_modules/discord.js/src/client/websocket/WebSocketShard.js:264:10)

at WebSocket.onMessage (/rbd/pnpm-volume/dd393cd1-6a2b-4414-a08c-33fb4f210cf7/node_modules/.registry.npmjs.org/ws/6.2.1/node_modules/ws/lib/event-target.js:120:16)

at emitOne (events.js:116:13)

at WebSocket.emit (events.js:211:7)

at Receiver.receiverOnMessage (/rbd/pnpm-volume/dd393cd1-6a2b-4414-a08c-33fb4f210cf7/node_modules/.registry.npmjs.org/ws/6.2.1/node_modules/ws/lib/websocket.js:789:20)

What do i do now?

#2

Hey @smixqse, welcome to the Glitch forum!

That error looks like a problem in Discord.JS’s Shard Manager, but that seems pretty unlikely, so I suspect that it’s a different problem pretending to be a problem with Shard Manager. Right after you run enable-pnpm your project’s logs should output the information from the install process. Do any errors show up in that output?

It also might be helpful for us to see your package.json file contents, or better yet to have the name of your project so we can take a look.

#3

package.json
{
“//1”: “describes your app and its dependencies”,
“//2”: “https://docs.npmjs.com/files/package.json”,
“//3”: “updating this file will download and update your packages”,
“name”: “botdocore”,
“version”: “0.0.1”,
“description”: “Bot do server do Core feito em Discord.js”,
“main”: “server.js”,
“scripts”: {
“start”: “node server.js”
},
“dependencies”: {
“discord.js”: “github:discordjs/discord.js”,
“enmap”: “^2.7.2”,
“express”: “^4.16.4”,
“imgur”: “^0.2.1”,
“node-vibrant”: “^3.1.1”,
“set”: “^1.1.1”
},
“engines”: {
“node”: “8.x”
},
“repository”: {
“url”: “https://glitch.com/edit/#!/welcome-project
},
“license”: “MIT”,
“keywords”: [
“node”,
“glitch”,
“express”,
“discord.js”
]
}

no errors when i use enable-pnpm.

node v8.15.0, with pnpm

Installing...

Resolving: total 5, reused 0, downloaded 0

Resolving: total 45, reused 6, downloaded 0

Resolving: total 45, reused 22, downloaded 0

Resolving: total 94, reused 41, downloaded 0

Resolving: total 125, reused 92, downloaded 0

Resolving: total 163, reused 135, downloaded 0

Resolving: total 173, reused 163, downloaded 0

Resolving: total 198, reused 198, downloaded 0

 WARN  discord.js: prism-media@1.0.1 requires a peer of ffmpeg-binaries@^4.0.0 but none was installed.

 WARN  discord.js: prism-media@1.0.1 requires a peer of ffmpeg-static@^2.4.0 but none was installed.

 WARN  discord.js: prism-media@1.0.1 requires a peer of node-opus@^0.3.1 but none was installed.

 WARN  discord.js: prism-media@1.0.1 requires a peer of opusscript@^0.0.6 but none was installed.

 WARN  discord.js@12.0.0-dev requires a peer of @discordjs/uws@^11.149.1 but none was installed.

 WARN  discord.js@12.0.0-dev requires a peer of bufferutil@^4.0.1 but none was installed.

 WARN  discord.js@12.0.0-dev requires a peer of erlpack@discordapp/erlpack but none was installed.

 WARN  discord.js@12.0.0-dev requires a peer of libsodium-wrappers@^0.7.4 but none was installed.

 WARN  discord.js@12.0.0-dev requires a peer of sodium@^3.0.2 but none was installed.

 WARN  discord.js@12.0.0-dev requires a peer of zlib-sync@^0.1.4 but none was installed.

Resolving: total 202, reused 201, downloaded 0

Packages: +202

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Resolving: total 202, reused 202, downloaded 0

Resolving: total 202, reused 202, downloaded 0

Resolving: total 202, reused 202, downloaded 0

Resolving: total 202, reused 202, downloaded 0

Resolving: total 202, reused 202, downloaded 0

Resolving: total 202, reused 202, downloaded 0, done


dependencies:

+ discord.js 12.0.0-dev

+ enmap 2.7.2 (4.8.2 is available)

+ express 4.16.4

+ imgur 0.2.1 (0.3.1 is available)

+ node-vibrant 3.1.1 (3.2.0-alpha is available)

+ set 1.1.1


Total install time: 22747ms

the name of the project is botdocore.

#4

Yeah I’m also getting this just now unfortunately, strange things are afoot!

#5

Hi @alexsurelee, welcome to the Glitch forum!

Can you also provide your project name and / or package.json contents?

@smixqse I haven’t looked at your project yet, but I do note that the discordjs GitHub repo has a recent commit having to do with Sharding, and you’re using the repo as a dependency, so any new commits will end up in your packages on the next install cycle. What happens if you change your package.json to use the stable npm module instead of the repo?

#6

Yeah sorry my project isn’t actually a Glitch application. Definitely appears to be that the master branch of the library has been broken though. Just a matter of time I guess :slight_smile:

#7

Solution looks to be to update your node version!