Skip to content

🧐[问题 | question] 使用docker 启动项目报错 #11417

Open
@BestKai

Description

🧐 问题描述 | Problem description

启动之后控制台报错

wait  - [Webpack] Compiling...
app-1  | error - Can not resolve dependence : '**/node_modules/@umijs/bundler-webpack/node_modules/react-error-overlay/lib/index.js', please install it
app-1  | error - AssertionError [ERR_ASSERTION]: dependence not found: **/node_modules/@umijs/bundler-webpack/node_modules/react-error-overlay/lib/index.js
app-1  |     at Dep.buildExposeContent (/app/node_modules/@umijs/mfsu/dist/dep/dep.js:90:31)
app-1  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
app-1  |     at async DepBuilder.writeMFFiles (/app/node_modules/@umijs/mfsu/dist/depBuilder/depBuilder.js:159:23)
app-1  |     at async DepBuilder.build (/app/node_modules/@umijs/mfsu/dist/depBuilder/depBuilder.js:137:7)
app-1  |     at async MFSU.buildDeps (/app/node_modules/@umijs/mfsu/dist/mfsu/mfsu.js:227:7) {
app-1  |   generatedMessage: false,
app-1  |   code: 'ERR_ASSERTION',
app-1  |   actual: null,
app-1  |   expected: true,
app-1  |   operator: '=='
app-1  | }

浏览器控制台报错

mf-va_remoteEntry.js:862 Uncaught (in promise) Error: Module ".//app/node_modules/@umijs/utils/compiled/strip-ansi/index.js" does not exist in container.
while loading ".//app/node_modules/@umijs/utils/compiled/strip-ansi/index.js" from webpack/container/reference/mf
    at mf-va_remoteEntry.js:862:11

💻 示例代码 | Sample code

使用官方Node.js镜像作为基础镜像

FROM node:20.18.1

WORKDIR /app



COPY package*.json ./



RUN npm install



COPY . .


RUN npm run build



EXPOSE 8000



CMD ["npm", "start"]

🚑 其他信息 | Other information

OS:

Node:

浏览器 | browser:

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions