I have been trying all sorts of solutions to get my deployment working locally and on the Netlify domain, but the build failed to complete the build process.
Jun 27, 10:23:56 PM: 4259141a INFO [GET] https://685f0bc37c59840008a9f9ef--analytics-logging.netlify.app/
Jun 27, 10:23:56 PM: 4259141a ERROR TypeError: Cannot read properties of undefined (reading 'manifestPath')
at requestHandler (/var/task/node_modules/@netlify/vite-plugin-react-router/node_modules/react-router/dist/development/index.js:11020:29)
at Module.<anonymous> (file:///var/task/node_modules/@netlify/vite-plugin-react-router/dist/index.mjs:14:30)
at async bm (file:///var/task/___netlify-bootstrap.mjs:3:109468)
at async Runtime.handler (file:///var/task/___netlify-bootstrap.mjs:3:109139)
at async Runtime.handleOnceStreaming (file:///var/runtime/index.mjs:1238:26)
Netlify Build Complete
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
(Netlify Build completed in 3.7s)
โฌฅ Static server listening to 3999
โญโโโโโโโโโโโโโโโโโโโโโโโ โฌฅ โโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ Local dev server ready: http://localhost:8888 โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Request from ::1: GET /
โฌฅ Function react-router-server has returned an error: Cannot find module '/Users/xxx/Documents/analytics/.netlify/functions-serve/.unzipped/react-router-server/node_modules/react-router/dist/development/index.mjs' imported from /Users/xxx/Documents/analytics/.netlify/functions-serve/.unzipped/react-router-server/.netlify/v1/functions/react-router-server.mjs
hey @abisalde thanks for getting in touch! Keep in mind as well that if it doesnโt build locally, it will not build on Netlify.
Can you confirm that after installing the plugin, you adjusted your vite.config.ts file as mentioned in the docs here? React Router on Netlify | Netlify Docs
Yes, I did. I followed the docs to the later and did the same for the template providing by react-router team for Netlify and got the same error as mine.
thanks for following up and opening that issue! Iโm wondering if the issue is that you still need to run the remix.init script. When you install deps with npm via npx create-remix@latest, youโre prompted to run the script during setup:
deps Install dependencies with npm?
Yes
init This template has a remix.init script. Do you want to run it?
Yes
โ Dependencies installed
โ Dependencies for remix.init script installed
โผ Running template's remix.init script...
However when opting out (to instead use yarn), this step gets skipped, although youโd still need to run the script manually:
deps Install dependencies with npm?
No
โผ Skipping install step. Remember to install dependencies after setup with npm install.
โ Git initialized
โผ Skipping template's remix.init script. After installing dependencies, you can run the script in the remix.init directory with npx remix init.
Can you let me know if you completed that step as well? When going through this setup and installing the script, Iโm able to get the home page to render properly:
I am not using Remix but I am using Vite-config and I followed through with npx create-react-router@latest and following the prompt as shown on the terminal
hey @abisalde thanks again for following up on this, and apologies for the misunderstanding there. If youโre looking to just run straight React Router, Iโd still recommend Netlifyโs own internal docs: React Router on Netlify | Netlify Docs
scaffold the project npx create-react-router@latest --template netlify/react-router-template
Hi Marcus, when you use the netlify/react-router-template, the start command runs npm run dev. The start command should serve the built files (which is the original issue of this thread), rather than running the dev server
Iโm trying to debug a production-specific issue, so I need a better environment to test the built files. The behavior of Vite varies significantly between development and production. Additionally, Netlify wraps everything in a server function for production, making npm run dev far from ideal for debugging
Also, the docs are pretty sparse right now, mostly just a command to run. It would be awesome to have more detailed documentation for react-router v7
This is a development setup you have done, The issue is about setting up production build which I did with the template just like this npx create-react-router@latest --template netlify/react-router-template.
Please, can you try with npx netlify serve for production build?
Thanks for following up on this, and apologies for the delay! Iโve since replicated and escalated this issue internally, weโll follow up again here as soon as we have the next steps.
As stated in the issue cited below, this is an issue with Nodeโs module resolution and probably needs to have a change to the React Router Vite plugin for Netlify.