cornpopguy
cornpopguy9mo ago

Error related to jsx-email ✘ [ERROR] Could not resolve "path"

I just recently updated my packages and installed jsx-email and now I am getting this error bellow:
⠸ Preparing Convex functions...
✘ [ERROR] Could not resolve "path"

node_modules/.pnpm/clean-css@5.3.3/node_modules/clean-css/lib/options/rebase-to.js:1:19:
1 │ var path = require('path');
╵ ~~~~~~

The package "path" 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.
⠸ Preparing Convex functions...
✘ [ERROR] Could not resolve "path"

node_modules/.pnpm/clean-css@5.3.3/node_modules/clean-css/lib/options/rebase-to.js:1:19:
1 │ var path = require('path');
╵ ~~~~~~

The package "path" 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.
I think that this is happening in my email.ts file, I tried adding 'use node'; but then I get:
⠇ Checking for index or schema changes...
✖ Error: Unable to push deployment config to https://adventurous-mockingbird-762.convex.cloud
Error fetching POST https://adventurous-mockingbird-762.convex.cloud/api/push_config 400 Bad Request: InvalidModules: Hit an error while pushing:
Loading the pushed modules encountered the following
error:
Uncaught Failed to analyze clerk/emails.js: Unexpected token '<'
⠇ Checking for index or schema changes...
✖ Error: Unable to push deployment config to https://adventurous-mockingbird-762.convex.cloud
Error fetching POST https://adventurous-mockingbird-762.convex.cloud/api/push_config 400 Bad Request: InvalidModules: Hit an error while pushing:
Loading the pushed modules encountered the following
error:
Uncaught Failed to analyze clerk/emails.js: Unexpected token '<'
Here is the source code of my email.ts: https://pastebin.com/raw/eFcUZUYB Is it possible to resolve this if so how?
No description
6 Replies
cornpopguy
cornpopguyOP9mo ago
No description
cornpopguy
cornpopguyOP9mo ago
This is certainly related to the jsx-email package as when I remove it it is successfull:
No description
lee
lee9mo ago
it looks like jsx-email is not supported in browser/deno-like environments https://www.npmjs.com/package/jsx-email ; it only works in node. to use it in convex you should only use it in actions and put "use node"; at the top of the file.
npm
jsx-email
Render JSX email components to HTML email. Latest version: 1.12.1, last published: 5 hours ago. Start using jsx-email in your project by running npm i jsx-email. There are no other projects in the npm registry using jsx-email.
cornpopguy
cornpopguyOP9mo ago
I have 'use node'; at the top of my file and it is an internal action. Oh, sorry, turns out I did not have 'use node'; in one of the files that use the jsx-email. Is it possible to automatically add it to files that use the jsx-email or something?
Michal Srb
Michal Srb9mo ago
It's not unfortunately. You have to tell Convex which runtime you want to use.
cornpopguy
cornpopguyOP9mo ago
Okay, thanks.

Did you find this page helpful?