node
Hey, I'm trying to deploy my worker but I keep getting this 11 errors all similar to this one:
and then when I try to add "node_compat = true" to wrangler.toml I get this error:
and then when I remove compatibility_flags = ["nodejs_compat"]
I get tons of errors and wranings like :
All I'm trying to do is to run this code in "index.js"
Please help
The package "string_decoder" wasn't found on the file system but is built into node.
Add "node_compat = true" to your wrangler.toml file and make sure to prefix the module name with "node:" to enable Node.js compatibility.
and then when I try to add "node_compat = true" to wrangler.toml I get this error:
▲ [WARNING] Enabling Node.js compatibility mode for built-ins and globals. This is experimental and has serious tradeoffs. Please see https://github.com/ionic-team/rollup-plugin-node-polyfills/ for more details.
✘ [ERROR] Thecompatibility flag cannot be used in conjunction with the legacynodejs_compatflag. If you want to use the Workers runtime Node.js compatibility features, please remove the--node-compatargument from your CLI command or--node-compatfrom your config file.node_compat = true
and then when I remove compatibility_flags = ["nodejs_compat"]
I get tons of errors and wranings like :
▲ [WARNING] The package "node:worker_threads" wasn't found on the file system but is built into node.
✘ [ERROR] Could not resolve "worker_threads"
node_modules/@discordjs/ws/dist/index.js:113:42:
113 │ var import_node_worker_threads2 = require("worker_threads");
All I'm trying to do is to run this code in "index.js"
const { ActivityType } = require("discord.js");
client.user.setPresence({
activities: [{
name: "Ready!",
}],
status: "online"
});
Please help