Module not found: Error: Can't resolve './pages/SignIn' in '/opt/render/project/src/src'

Hello,

I just tried launching a new app, but am getting a weird error: “Module not found: Error: Can’t resolve ‘./pages/SignIn’ in ‘/opt/render/project/src/src’”

My Static Site Project Settings are:

  • Root Directory:
  • Build Command: npm run build
  • Publish directory: build

routes.js file:

import {useRoutes, Navigate} from "react-router-dom"

import Auth from "./layouts/Auth"
import Main from "./layouts/Main"

import SignIn from "./pages/SignIn"
import SignUp from "./pages/SignUp"
import Forgot from "./pages/Forgot"
import Confirm from "./pages/Confirm"
import ChangePassword from "./pages/ChangePassword"

import Categories from "./pages/Categories"
import Category from "./pages/Category"
import Article from "./pages/Article"
import Cart from "./pages/Cart"
import OrderHistory from "./pages/OrderHistory"

import PageNotFound from "./pages/PageNotFound"

export default function Routers({isLoggedIn}) {     
    let element = useRoutes([
        {
            element: <Auth />,
            children: [                
                { path: "/", element: <SignIn /> },
                { path: "/signup", element: <SignUp /> },
                { path: "/forgot", element: <Forgot /> },
                { path: "/confirm/:slug", element: <Confirm /> },
                { path: "/changepassword/:slug", element: <ChangePassword /> }
            ]
        },
        {
            element: isLoggedIn ? <Main /> : <Navigate to="/" />,
            children: [
                { path: "/categories", element: <Categories /> },
                { path: "/category/:slug", element: <Category /> },
                { path: "/article/:slug", element: <Article /> },
                { path: "/cart/", element: <Cart /> },
                { path: "/orderhistory", element: <OrderHistory /> }
            ]
        },
        {
            path: "*", element: <PageNotFound />
        }       
    ]);
    return (
        element
    )
} 

My package.json “scripts” area:

"scripts": {
    "start": "react-scripts start",
    "build": "cross-env GENERATE_SOURCEMAP=false react-scripts build",
    "deploy": "serve -s build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  }

“dependencies” area:

  "dependencies": {
    "@heroicons/react": "^2.0.18",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "@types/jest": "^27.5.2",
    "@types/node": "^17.0.45",
    "@types/react": "^18.2.14",
    "@types/react-dom": "^18.2.6",
    "framer-motion": "^10.12.18",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-router-dom": "^6.14.1",
    "react-scripts": "5.0.1",
    "serve": "^14.2.0",
    "typescript": "^4.9.5",
    "web-vitals": "^2.1.4",
    "workbox-background-sync": "^6.6.0",
    "workbox-broadcast-update": "^6.6.0",
    "workbox-cacheable-response": "^6.6.0",
    "workbox-core": "^6.6.0",
    "workbox-expiration": "^6.6.0",
    "workbox-google-analytics": "^6.6.0",
    "workbox-navigation-preload": "^6.6.0",
    "workbox-precaching": "^6.6.0",
    "workbox-range-requests": "^6.6.0",
    "workbox-routing": "^6.6.0",
    "workbox-strategies": "^6.6.0",
    "workbox-streams": "^6.6.0"
  }

I think, I got this error after renaming my components and routes (from german to english with CamelCase syntax) like:
anmelden → SignIn
registrieren → SignUp

Thanks and Regards,

Sergej

Hi,

You may need to check the file casing matches in Git (e.g. GitHub), not in VS Code. Git usually won’t be up file case changes by default.

Alan

1 Like

In GitHub Repo looks all the same:

I also tried in Render Dashboard to deploy manually with “Clean build cache & deploy”, but no result… :pensive:

Not quite, Signin.tsx on GitHub has a lowercase i.

Alan

Thanks! I runned “git config core.ignorecase false” in VSCode and once again commited. Deployed. Works! :partying_face:

Very glad to hear you got it sorted :blush:

Alan

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.