Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Website in dev working perfectly, but when running npm build + npm start (in production) doesn't work. #11523

Closed
JoaoGuimaraes22 opened this issue Mar 31, 2020 · 6 comments

Comments

@JoaoGuimaraes22
Copy link

JoaoGuimaraes22 commented Mar 31, 2020

Bug report

Describe the bug

When developing, running npm run dev (next dev), the website works perfectly and the routing to other pages works as intended.
But, when running the project in production (next build + next start), the routing doesn't work, for some reason.
I'm using, for routing <Link href="/users/signup"/>, as intended in the documentation.
The routing isn't dynamic

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. See Project on the client folder of the repo / Clone https://github.com/JoaoGuimaraes22/Prodity/tree/master
  2. Run npm install
  3. Run npm run dev, to see it working fine (routes to /users/login and /users/signup)
    4 Then run npm run build and npm run start, check the routes, they'll not be working (or at least they didn't work for me);

Expected behavior

Routing in production to work the same as it does in dev mode.

System information

  • OS: Windows
  • Browser: Chrome
  • Version of Next.js: 9.3.3
@fabinppk
Copy link

fabinppk commented Apr 1, 2020

In my tests i had problem with strip-ansi.

cd Prodity/client
npm install (here broken to me)
to fix: npm i strip-ansi --save
npm run build
npm run start

Works!!

@JoaoGuimaraes22
Copy link
Author

Did you test going into the Login or Sign Up routes? It still gave me a 404 when I tried, after npm installing strip-ansi. By the way, what is strip-ansi used for, i wasn't using it in my project.

@timneutkens
Copy link
Member

Sounds like a duplicate of vercel/next-plugins#282

I'd recommend using the built-in CSS support which fixes this issue.

@fabinppk
Copy link

fabinppk commented Apr 2, 2020

I think i undestand your question.

nested routes does't work on production. thats right?

Try this:
rename the folder users to [users].
image

Works here.

@JoaoGuimaraes22
Copy link
Author

Hey man, it works!
Big thanks Fabiano.

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants