A compatible class export was not found.

When use HMR and edit files It always sends an error, no matter what file is being edited:
9|Wishbot | [ERROR] [HMR-Plugin]: Failed to load pieces from /root/node/Customers/Wishbot/src/commands/collection.js. Error [EMPTY_MODULE]: A compatible class export was not found. [/root/node/Customers/Wishbot/src/commands/collection.js]
9|Wishbot | at LoaderStrategy.load (/root/node/Customers/Wishbot/node_modules/@sapphire/pieces/dist/lib/strategies/LoaderStrategy.js:92:19)
9|Wishbot | at async CommandStore.load (/root/node/Customers/Wishbot/node_modules/@sapphire/pieces/dist/lib/structures/Store.js:89:26)
9|Wishbot | at async SlashCommand.reload (/root/node/Customers/Wishbot/node_modules/@sapphire/pieces/dist/lib/structures/Piece.js:94:9)
9|Wishbot | at async SlashCommand.reload (/root/node/Customers/Wishbot/node_modules/@sapphire/framework/dist/lib/structures/Command.js:108:5)
9|Wishbot | at async /root/node/Customers/Wishbot/node_modules/@sapphire/plugin-hmr/dist/lib/hmr.js:49:13
9|Wishbot | at async Object.fromAsync (/root/node/Customers/Wishbot/node_modules/@sapphire/result/dist/index.js:615:22)
9|Wishbot | at async handlePiecePathUpdate (/root/node/Customers/Wishbot/node_modules/@sapphire/plugin-hmr/dist/lib/hmr.js:47:20) {
9|Wishbot | type: 'EMPTY_MODULE',
9|Wishbot | path: '/root/node/Customers/Wishbot/src/commands/collection.js'
9|Wishbot | }
9|Wishbot | [ERROR] [HMR-Plugin]: Failed to load pieces from /root/node/Customers/Wishbot/src/commands/collection.js. Error [EMPTY_MODULE]: A compatible class export was not found. [/root/node/Customers/Wishbot/src/commands/collection.js]
9|Wishbot | at LoaderStrategy.load (/root/node/Customers/Wishbot/node_modules/@sapphire/pieces/dist/lib/strategies/LoaderStrategy.js:92:19)
9|Wishbot | at async CommandStore.load (/root/node/Customers/Wishbot/node_modules/@sapphire/pieces/dist/lib/structures/Store.js:89:26)
9|Wishbot | at async SlashCommand.reload (/root/node/Customers/Wishbot/node_modules/@sapphire/pieces/dist/lib/structures/Piece.js:94:9)
9|Wishbot | at async SlashCommand.reload (/root/node/Customers/Wishbot/node_modules/@sapphire/framework/dist/lib/structures/Command.js:108:5)
9|Wishbot | at async /root/node/Customers/Wishbot/node_modules/@sapphire/plugin-hmr/dist/lib/hmr.js:49:13
9|Wishbot | at async Object.fromAsync (/root/node/Customers/Wishbot/node_modules/@sapphire/result/dist/index.js:615:22)
9|Wishbot | at async handlePiecePathUpdate (/root/node/Customers/Wishbot/node_modules/@sapphire/plugin-hmr/dist/lib/hmr.js:47:20) {
9|Wishbot | type: 'EMPTY_MODULE',
9|Wishbot | path: '/root/node/Customers/Wishbot/src/commands/collection.js'
9|Wishbot | }
The command files load fine when the bot starts up and get executed without any problems
4 Replies
Favna
Favna•2y ago
is collection.js empty though? or does it otherwise not export a Command class?
Himori
HimoriOP•2y ago
not quite empty 😄
Favna
Favna•2y ago
you register your commands externally? Interesting. I think you're the first person I see making use of that. anyway I'm not quite sure what is happening there then. Best I can give you is to start your bot with a debugging and set some breakpoints at the lines that are in that stacktrace so you can analyze why it thinks it's empty.
Favna
Favna•2y ago
I know there is a bug with HMR and using BulkOverwrite but that isn't this.
Want results from more Discord servers?
Add your server