簡體   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