I’m having a problem with my deploy on Netlify. My Next.js project builds and deploys perfectly. However, when I go to a certain page on my site, I’m met with the following errors:
I’m not sure what caused this, as deploying the same project on Vercel works perfectly. However, I’d rather use Netlify in this use case. Below, I’ve written a few details about my project:
- Next.js 11
- React/React-DOM 17.0.2
- Node 14.17.1
- NPM 6.14.13
I think it has to do with my usage of getServerSideProps and this package, next-mdx-remote. Something about the combination of the two is making the page not run on Netlify.
If you can provide any help, I would really appreciate it. I can also provide any other necessary information needed.
Hi, @p0w3r_zurg3. It looks similar to the errors being reported for this status page incident:
Would you please try deploying the site and let us know if that does not resolve the issue (or if there are any question)?
I redeployed, and the same error came up. I’ve attached an image with the specific error, if that helps.
Hi, @p0w3r_zurg3. I need the actual text from the screenshot to troubleshoot. Would you be willing to post the text itself (instead of a screenshot of the text)?
Yup! Here it is:
"errorMessage": "Error: Cannot find module 'esbuild'\nRequire stack:\n- /var/task/netlify/functions/next_course_course_lesson/nextPage/chunks/118.js\n- /var/task/netlify/functions/next_course_course_lesson/nextPage/pages/course/[course]/[lesson].js\n- /var/task/netlify/functions/next_course_course_lesson/nextPage/index.js\n- /var/task/netlify/functions/next_course_course_lesson/renderNextPage.js\n- /var/task/netlify/functions/next_course_course_lesson/next_course_course_lesson.js\n- /var/task/next_course_course_lesson.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
"Runtime.ImportModuleError: Error: Cannot find module 'esbuild'",
" at _loadUserApp (/var/runtime/UserFunction.js:100:13)",
" at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
" at Object.<anonymous> (/var/runtime/index.js:43:30)",
" at Module._compile (internal/modules/cjs/loader.js:999:30)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)",
" at Module.load (internal/modules/cjs/loader.js:863:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:708:14)",
" at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)",
" at internal/main/run_main_module.js:17:47"
hey there, thanks for that info. We had a chance to chat with some of our NextJS pros today, and there is a pre-existing problem with ES builds that may be causing the problems you are seeing.
To stay in the loop, please follow along with this issue:
The problem seems to specifically be tied to this package:
I tried the environmental variable specified in the Github issue, but that didn’t help.
Is there anything else I could do?
Are we sure that we’re not seeing this issue?
is there any updates / possible fixes on this?
EDIT: so the current solution for this problem is to remove next-mdx-remote and use another markdown parser (remark-parse and rehype-react)
You can see the working example in here https://github.com/rehypejs/rehype-react#use