How do i fix platform: 'node'

The package "timers/promises" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
6 Replies
kian
kian14mo ago
It's an error from esbuild which is a little misleading, since you can't add that setting. Workers aren't NodeJS, so Node modules aren't available - a limited subset are available which doesn't include timers via the nodejs_compat compatibility flag. Which methods are you trying to use specifically?
Kurapika
KurapikaOP14mo ago
I don't understand what you meant by method. But i was trying to run wrangler dev
kian
kian14mo ago
The error is saying that you, or a dependency you have, is trying to import the NodeJS timers module which doesn't exist in Workers. Stuff like setTimeout and scheduler.wait are all available in Workers as globals.
Kurapika
KurapikaOP14mo ago
Why is it saying i should use "platform:node"?
kian
kian14mo ago
This. It's an error straight from esbuild, and you can't control Wrangler's esbuild config.
Kurapika
KurapikaOP14mo ago
So, i should use an alternative that is available on wrangler All i am trying to do is to set up discord on wrangler. Is there an alternative that you can recommend?
Want results from more Discord servers?
Add your server