I need help with a vercel deployment. #8123
-
I have created an API route that runs with MathJax-node but it seems that vercel does not find the files. When I am building locally everything works fine. Anyone an idea why this could be? import type { NextApiRequest, NextApiResponse } from 'next';
const mjAPI = require('mathjax-node');
type resData = {
svg: {
input: string;
svg: string;
};
};
type reqData = {
input: string;
};
export default async function handler(
req: NextApiRequest,
res: NextApiResponse<resData>
) {
const { input } = req.query as reqData;
const mathString = input as string;
const svg = await mjAPI.typeset({
math: mathString,
format: 'TeX',
svg: true,
color: '#000',
});
res.status(200).json({ svg });
} the Error Log
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
I'm sorry to hear you're having trouble with this deployment. Thanks for sharing the error log and code! If you can also answer the following questions, that will help me get a better understanding of what's happening.
|
Beta Was this translation helpful? Give feedback.
-
@amyegan Thank you for you rreply. I honestly ditched the backend l.ib and now I am using the frontend version of it. TO answer your questions anyway
|
Beta Was this translation helpful? Give feedback.
-
Hello, I have a similar issue; however, I ultimately need to use MathJax with Node.js (using mathjax-node), not in the browser . I am uploading a React/Node.js app to Vercel. On my local machine, everything works fine (also after clear reinstallations). Mathjax-node consistently works.
Part of my code:
My only one tip is that VSCode shows when i hover over import mj from "mathjax-node"; following information:
However, for me it is not clear as in local machine everything works regardless of this information. Also: I also would like to add that i am using JS not TS in my app. If you have any insights or solutions, I would greatly appreciate your assistance. |
Beta Was this translation helpful? Give feedback.
I managed to solve the problem with mathjax version 3 package instead of mathjax-node. I paste the code below, maybe it will be useful to someone. Mathjax in version 3 works without errors with vercel.