繁体   English   中英

找不到模块:无法在 Docker 实现中的“/client/node_modules/@mui/icons-material”中解析“react/jsx-runtime”

[英]Module not found: Can't resolve 'react/jsx-runtime' in '/client/node_modules/@mui/icons-material' in Docker implementation

" 每当我构建并开始运行我的 dockerized react 应用程序时,它都会不断给出标题中提到的错误。虽然我在我的 Dockerfile 中单独给出了包安装命令,但仍然得到同样的错误。我还安装了包 jsx-runtime 但是没有结果。请任何可以指导我的人。

FROM node:16-alpine
# set the working directory
WORKDIR /client

# add `/app/node_modules/.bin` to $PATH
ENV PATH /client/node_modules/.bin:$PATH


# install app dependencies
COPY package.json ./
COPY package-lock.json ./

RUN npm install --force
RUN npm install -g nodemon
RUN npm install --save ra-data-json-server --force
RUN npm install @material-ui/core --force
RUN npm install @material/theme --force
Run npm install jsx-runtime --force

COPY . ./

EXPOSE 3000

CMD [ "npm", "start" ]

我在构建 docker 文件之前删除了 package.json 和 node 模块,然后在 Dockerfile 中添加了npm install 它对我有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM