Marcin
Marcin3mo ago

Error: Could not resolve...

I am willing to use nodejs package. I am following the instruction here: https://docs.convex.dev/functions/bundling I have setup my convex.json as follows: { "node": { "externalPackages": ["*"] } } Still i got tons of messages like: --- [ERROR] Could not resolve "events" node_modules/cli-progress/lib/multi-bar.js:4:30: 4 │ const _EventEmitter = require('events'); ╵ ~~~~ The package "events" 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. --- In my code I am importing the package: --- import nodejspackage from "nodejs-package"; --- What I am doing wrong so it does not work?
Bundling | Convex Developer Hub
Bundling is the process of gathering, optimizing and transpiling the JS/TS
3 Replies
Convex Bot
Convex Bot3mo ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
Marcin
MarcinOP3mo ago
I solved it by "use node" at the beginning of the file It would be nice to have that info in the documentation 🙂
Hmza
Hmza3mo ago
Runtimes | Convex Developer Hub
Convex functions can run in two runtimes:

Did you find this page helpful?