Node Compat on Pages Functions

I'm trying to use Knex within my Nuxt project (Pages), but getting build errors due to node compatability. Setting the Compatability flag from within the dashboard does not help.
20:47:55.006 The package "timers" wasn't found on the file system but is built into node.
20:47:55.006 Add the "nodejs_compat" compatibility flag to your Pages project and make sure to prefix the module name with "node:" to enable Node.js compatibility.
20:47:55.006
20:47:55.006
20:47:55.007 ✘ [ERROR] Build failed with 18 errors:
20:47:55.007
20:47:55.007 ../node_modules/colorette/index.cjs:5:18: ERROR: Could not resolve "tty"
20:47:55.007 ../node_modules/knex/lib/builder-interface-augmenter.js:3:32: ERROR: Could not resolve "util"
20:47:55.007 ../node_modules/knex/lib/client.js:3:30: ERROR: Could not resolve "util"
20:47:55.007 ../node_modules/knex/lib/dialects/mysql/index.js:5:30: ERROR: Could not resolve "util"
20:47:55.007 ../node_modules/knex/lib/dialects/mysql/query/mysql-querycompiler.js:3:23: ERROR: Could not resolve "assert"
20:47:55.006 The package "timers" wasn't found on the file system but is built into node.
20:47:55.006 Add the "nodejs_compat" compatibility flag to your Pages project and make sure to prefix the module name with "node:" to enable Node.js compatibility.
20:47:55.006
20:47:55.006
20:47:55.007 ✘ [ERROR] Build failed with 18 errors:
20:47:55.007
20:47:55.007 ../node_modules/colorette/index.cjs:5:18: ERROR: Could not resolve "tty"
20:47:55.007 ../node_modules/knex/lib/builder-interface-augmenter.js:3:32: ERROR: Could not resolve "util"
20:47:55.007 ../node_modules/knex/lib/client.js:3:30: ERROR: Could not resolve "util"
20:47:55.007 ../node_modules/knex/lib/dialects/mysql/index.js:5:30: ERROR: Could not resolve "util"
20:47:55.007 ../node_modules/knex/lib/dialects/mysql/query/mysql-querycompiler.js:3:23: ERROR: Could not resolve "assert"
1 Reply
Hello, I’m Allie!
Timers isn’t supported by nodejs_compat, so you would need to find a way to build around it
Want results from more Discord servers?
Add your server