Closed AbbasSrour closed 1 year ago
Hey @AbbasSrour, are you seeing these errors when downloading and running a fresh version of the template? If so please could you share the error message(s), as well as details of your operating system and Node.js version?
The error log:
> next dev
- ready started server on 0.0.0.0:3000, url: http://localhost:3000
- info automatically enabled Fast Refresh for 1 custom loader
- event compiled client and server successfully in 846 ms (20 modules)
- wait compiling...
- event compiled client and server successfully in 371 ms (20 modules)
- wait compiling /page (client and server)...
- event compiled client and server successfully in 36.3s (1557 modules)
- wait compiling /_error (client and server)...
- error node_modules/.pnpm/@mdx-js+react@2.1.5_react@18.2.0/node_modules/@mdx-js/react/lib/index.js (33:32) @ createContext
- error createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/context-in-server-component
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/@mdx-js+react@2.1.5_react@18.2.0/node_modules/@mdx-js/react/lib/index.js:37:73)
at (rsc)/./node_modules/.pnpm/@mdx-js+react@2.1.5_react@18.2.0/node_modules/@mdx-js/react/lib/index.js (/home/ares/Downloads/tailwindui-protocol/.next/server/app/page.js:7869:1)
at __webpack_require__ (/home/ares/Downloads/tailwindui-protocol/.next/server/webpack-runtime.js:33:43)
at eval (webpack-internal:///(rsc)/./src/app/page.mdx:9:71)
at (rsc)/./src/app/page.mdx (/home/ares/Downloads/tailwindui-protocol/.next/server/app/page.js:4774:1)
at Function.__webpack_require__ (/home/ares/Downloads/tailwindui-protocol/.next/server/webpack-runtime.js:33:43)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async collectGenerateParams (/home/ares/Downloads/tailwindui-protocol/node_modules/.pnpm/next@13.4.12_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:826:17) {
name: 'TypeError',
digest: undefined
}
null
- event compiled client and server successfully in 11.7s (1676 modules)
- wait compiling /favicon.ico/route (client and server)...
- event compiled client and server successfully in 3.2s (1744 modules)
- warn Fast Refresh had to perform a full reload due to a runtime error.
- error node_modules/.pnpm/@mdx-js+react@2.1.5_react@18.2.0/node_modules/@mdx-js/react/lib/index.js (33:32) @ createContext
- error createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/context-in-server-component
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/@mdx-js+react@2.1.5_react@18.2.0/node_modules/@mdx-js/react/lib/index.js:37:73)
at (rsc)/./node_modules/.pnpm/@mdx-js+react@2.1.5_react@18.2.0/node_modules/@mdx-js/react/lib/index.js (/home/ares/Downloads/tailwindui-protocol/.next/server/app/page.js:7869:1)
at __webpack_require__ (/home/ares/Downloads/tailwindui-protocol/.next/server/webpack-runtime.js:33:43)
at eval (webpack-internal:///(rsc)/./src/app/page.mdx:9:71)
at (rsc)/./src/app/page.mdx (/home/ares/Downloads/tailwindui-protocol/.next/server/app/page.js:4774:1)
at Function.__webpack_require__ (/home/ares/Downloads/tailwindui-protocol/.next/server/webpack-runtime.js:33:43)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async collectGenerateParams (/home/ares/Downloads/tailwindui-protocol/node_modules/.pnpm/next@13.4.12_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:826:17) {
name: 'TypeError',
digest: undefined
}
null``````
The machine I'm using is running Arch, node18.16 through volta-bin, and pnpm for the package manager,
Thanks for sharing! I can reproduce the issue now. It looks like pnpm might be resolving the dependencies a little differently to npm. Either way I have verified that the issue can be resolved by upgrading the Next.js and MDX dependencies:
pnpm install next@latest eslint-config-next@latest @next/mdx@latest @mdx-js/loader@latest @mdx-js/react@latest
Alternatively you can re-download the template as this has been updated to include the upgraded versions
I hope that helps, but please re-open the issue if you're still experiencing issues 👍
What component (if applicable)
Describe the bug A number of bugs are being raised when you try to run or build the template, the main issue was next "use client;". Been debugging it for the last couple of days and after doing a lot of changes (one of them updating everything to last version) and then going back and reverting them one by one, the issue was back again when I reverted the package.json to the previous original version.
Here is the current package json that works for me, I can't go back and check which dependency exactly is causing the issue because I have little time left, but I have already checked that the bump in next package was not it. Here is a screen shot of the package changes:
and here is the new package json