Skip to content

windows docker构建因缺少前置条件构建失败 #330

@anyongjin

Description

@anyongjin

Describe the bug
在windows执行docker-compose build会失败,报错如下:

#20 [web deps 4/4] RUN npm ci
#20 2.360 npm error code EUSAGE
#20 2.363 npm error
#20 2.363 npm error The `npm ci` command can only install with an existing package-lock.json or
#20 2.363 npm error npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or
#20 2.363 npm error later to generate a package-lock.json file, then try again.
#20 2.363 npm error
#20 2.363 npm error Clean install a project
#20 2.363 npm error
#20 2.363 npm error Usage:
#20 2.363 npm error npm ci
#20 2.363 npm error
#20 2.363 npm error Options:
#20 2.363 npm error [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
#20 2.363 npm error [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
#20 2.363 npm error [--include <prod|dev|optional|peer> [--include <prod|dev|optional|peer> ...]]
#20 2.363 npm error [--strict-peer-deps] [--foreground-scripts] [--ignore-scripts] [--no-audit]
#20 2.363 npm error [--no-bin-links] [--no-fund] [--dry-run]
#20 2.363 npm error [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
#20 2.363 npm error [-ws|--workspaces] [--include-workspace-root] [--install-links]
#20 2.363 npm error
#20 2.363 npm error aliases: clean-install, ic, install-clean, isntall-clean
#20 2.363 npm error
#20 2.363 npm error Run "npm help ci" for more info
#20 2.369 npm error A complete log of this run can be found in: /root/.npm/_logs/2026-02-27T08_39_24_695Z-debug-0.log
#20 ERROR: process "/bin/sh -c npm ci" did not complete successfully: exit code: 1

原因是npm ci依赖package-lock.json,而刚clone如果不执行npm install是没有package-lock.json的
所以需要先执行cd web && npm install才行
在markfile中有这个,但README中没有说明

Metadata

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