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
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?I don't understand what you meant by method. But i was trying to run wrangler dev
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.Why is it saying i should use "platform:node"?
This.
It's an error straight from esbuild, and you can't control Wrangler's esbuild config.
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?