Skip to content

react-router: not found #13020

@Omo-oba18

Description

@Omo-oba18

I'm using React Router as a...

library

Reproduction

Hi everyone, I don't know may be I am the one doing wrong, I am trying to dockerize the react project, and I am having the following error.
I didn't even modify the default Dockerfile that came when installing the project. I noticed the same error even when i changed the Docker config. here is both code:


# Node.js as base image
FROM node:20

# Working directory inside the container
WORKDIR /app

# Copying package.json and package-lock.json
COPY package.json package-lock.json ./

# Dependencies installation
RUN npm install

# Coping files
COPY . .

# Exposing the route
EXPOSE 5173

# Command to run the app in development mode
CMD ["npm", "run", "dev"]

#DEFAULT DOCKERFILE THAT CAME WITH PROJECT

FROM node:20-alpine AS development-dependencies-env
COPY . /app
WORKDIR /app
RUN npm ci

FROM node:20-alpine AS production-dependencies-env
COPY ./package.json package-lock.json /app/
WORKDIR /app
RUN npm ci --omit=dev

FROM node:20-alpine AS build-env
COPY . /app/
COPY --from=development-dependencies-env /app/node_modules /app/node_modules
WORKDIR /app
RUN npm run build

FROM node:20-alpine
COPY ./package.json package-lock.json /app/
COPY --from=production-dependencies-env /app/node_modules /app/node_modules
COPY --from=build-env /app/build /app/build
WORKDIR /app
CMD ["npm", "run", "start"]```

The error:
2025-02-13 20:18:38 
2025-02-13 20:18:38 > dev
2025-02-13 20:18:38 > react-router dev
2025-02-13 20:18:38 
2025-02-13 20:18:53 
2025-02-13 20:18:53 > dev
2025-02-13 20:18:53 > react-router dev
2025-02-13 20:18:53 
2025-02-13 20:18:56 
scarsoft_client  | 
scarsoft_client  | > dev
scarsoft_client  | > react-router dev
scarsoft_client  | 
scarsoft_client  | sh: 1: react-router: not found
scarsoft_client exited with code 127
2025-02-13 20:18:38 sh: 1: react-router: not found
2025-02-13 20:18:53 sh: 1: react-router: not found
2025-02-13 20:18:56 sh: 1: react-router: not found

The container start and stop by itself

### System Info

```shell
FEDORA latest version
nodejs v20.17.0

Used Package Manager

npm

Expected Behavior

Normally the container has to keep running until we stop it. it seems the react-router isn't found

Actual Behavior

react-router is not found

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions