node.js - Docker react 应用程序 : 404s will fallback to/

标签 node.js reactjs docker npm

我正在使用 npm 构建一个 React Javascript 应用程序,并希望将其部署在 docker 上。
当我在本地运行应用程序时:

npm start

这一切都很好。
但是当我构建一个 Docker 镜像并测试它时,我得到了以下错误:
$ docker run react-app

> keycloak-react@0.1.0 start /
> react-scripts start

ℹ 「wds」: Project is running at http://172.17.0.2/
ℹ 「wds」: webpack output is served from
ℹ 「wds」: Content not from webpack is served from /public
ℹ 「wds」: 404s will fallback to /
Starting the development server...

Dockerfile 看起来像:
FROM node:latest
COPY ./keycloak-react .
RUN npm install typescript
RUN npm install node-sass
RUN npm install sass
RUN npm install fibers
RUN npm install
EXPOSE 3000
CMD [ "npm", "start", "run", "--host", "0.0.0.0"]

我不知道该怎么做任何想法?

最佳答案

我刚刚修复,让添加 stdin_open: true 到 docker-compose 来修复它。

链接信息:https://github.com/facebook/create-react-app/issues/8688

关于node.js - Docker react 应用程序 : 404s will fallback to/,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61506475/

相关文章:

javascript - 同步逐行读取文件流

javascript - 将 Nodemailer 与 gmail 一起使用

css - 在动态 React 表上使用第 nth-child css

docker - 如何让 Docker 识别 ffmpeg?

node.js - 错误 MSB4062 : The "SetEnv" task could not be loaded from the assembly

javascript - Sequelize n :m association - Voting system - cannot set attribute of join table

javascript - react promise - TypeError : Cannot read property 'then' of undefined

javascript - 我是否需要使用 TypeScript + React 将事件处理程序绑定(bind)到 `this`?

java - 减慢代码速度?

docker - 在 Docker 中以自定义用户身份运行 ASP.NET Core 应用程序