FROM node:20-slim WORKDIR /app # Install dependencies COPY package.json ./ RUN npm install # Copy the rest of the source COPY . . # Build the project from source RUN npm run build # Default command (no server to run for this library; just print a notice) CMD ["sh", "-lc", "echo 'echarts-for-react build complete. lib/ and esm/ are ready.'"]
# Ignore node_modules and test and docs for docker build context node_modules __tests__ .git docs .eslintcache .dockerignore Dockerfile npm-debug.log* *.log
- Failing step: [4/6] RUN npm install (in Dockerfile, after COPY package.json ./)
- Exit code: 1
- Exact error output (preserved):
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
While resolving: echarts-for-react@3.0.6
Found: echarts@6.0.0
node_modules/echarts
dev echarts@"^6.0.0" from the root project
Could not resolve dependency:
peer echarts@"^5.1.2" from echarts-gl@2.0.9
node_modules/echarts-gl
dev echarts-gl@"^2.0.2" from the root project
Fix the upstream dependency conflict, or retry
this command with --force or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.
For a full report see:
/root/.npm/_logs/2026-04-12T22_24_41_538Z-eresolve-report.txt
npm notice
New major version of npm available! 10.8.2 -> 11.12.1
Changelog: https://github.com/npm/cli/releases/tag/v11.12.1
To update run: npm install -g npm@11.12.1
npm notice
A complete log of this run can be found in: /root/.npm/_logs/2026-04-12T22_24_41_538Z-debug-0.log
ERROR: process "/bin/sh -c npm install" did not complete successfully: exit code: 1
- Missing packages or files mentioned: none; the issue is a dependency conflict.
- Version mismatch info:
- Found: echarts@6.0.0 (root project)
- Required by echarts-gl@2.0.9: echarts@"^5.1.2"
- Root project declares echarts@"^6.0.0"
- Result: dependency resolution conflict (echarts 6 vs echarts-gl requiring echarts 5).
- Notable detail: upstream conflict suggested using --force or --legacy-peer-deps, or updating dependencies.FROM node:20-slim WORKDIR /app # Install dependencies with legacy peer deps to handle ECharts peer conflicts COPY package.json ./ RUN npm install --legacy-peer-deps # Copy the rest of the source COPY . . # Build the project from source RUN npm run build # Default command: show a friendly message CMD ["sh", "-lc", "echo 'echarts-for-react build complete. lib/ and esm/ are ready.'"]
Build timed out after 600s
# Multi-stage Dockerfile: build from source in a builder stage, then copy artifacts to final image FROM node:20-slim AS builder WORKDIR /app # Install dependencies COPY package.json ./ RUN npm install --legacy-peer-deps # Copy the rest of the source COPY . . # Build the project libraries (avoid running tests for speed) RUN npm run lib RUN npm run esm FROM node:20-slim WORKDIR /app # Copy built artifacts from builder COPY --from=builder /app/lib /app/lib COPY --from=builder /app/esm /app/esm # Optionally copy package.json for metadata COPY package.json ./ # Default command: print a friendly message CMD ["sh", "-lc", "echo 'echarts-for-react build complete. lib/ and esm/ are ready.'"]
Failing step and exit - Failing command: RUN npm run esm (Dockerfile line 15, builder step 7/7) Exact error messages and exit code - npm error Missing script: "esm" - To see a list of scripts, run: npm run - A complete log of this run can be found in: /root/.npm/_logs/2026-04-12T22_38_37_887Z-debug-0.log - ERROR: process "/bin/sh -c npm run esm" did not complete successfully: exit code: 1 Root cause (missing files/packages) - The npm script "esm" is not defined in package.json, leading to the Missing script error. Version information - No explicit version mismatch information shown. The build uses the node:20-slim base image; the error stems from a missing npm script rather than a version conflict. Suggested fix (concise) - Define an npm script named esm in package.json, or modify the Dockerfile to run an existing script that is defined (e.g., lib or lib:esm) instead of esm.
# Multi-stage Dockerfile: build from source in a builder stage, then copy artifacts to final image FROM node:20-slim AS builder WORKDIR /app # Install dependencies COPY package.json ./ RUN npm install --legacy-peer-deps # Copy the rest of the source COPY . . # Build the project libraries RUN npm run lib RUN npm run lib:esm FROM node:20-slim WORKDIR /app # Copy built artifacts from builder COPY --from=builder /app/lib /app/lib COPY --from=builder /app/esm /app/esm # Copy package metadata for consumers COPY package.json ./ # Default command: print a friendly message CMD ["sh", "-lc", "echo 'echarts-for-react build complete. lib/ and esm/ are ready.'"]
Concerns: Consider adding a .dockerignore to exclude unnecessary files (like tests, local docs, or node_modules) from the build context to speed up builds and reduce image size., The final image only contains lib/ and esm/ assets and a package.json; if runtime usage is expected, ensure downstream consumers have the necessary metadata and typings (e.g., types for TypeScript users) or consider publishing a more complete runtime package., If the repo already contains node_modules, COPY . . in the builder stage could override installed modules; ensure a proper .dockerignore to avoid shipping node_modules into the build context. Smoke [PASS]: set -e; [ -d /app/lib ] && [ -d /app/esm ] && echo 'lib and esm exist' || exit 1 Smoke [PASS]: set -e; [ -f /app/package.json ] && echo 'package.json present' || exit 1 Smoke [FAIL]: node -v && echo 'node present Output: sh: 1: Syntax error: Unterminated quoted string
# Multi-stage Dockerfile: build from source in a builder stage, then copy artifacts to final image FROM node:20-slim AS builder WORKDIR /app # Install dependencies COPY package.json ./ RUN npm install --legacy-peer-deps # Copy the rest of the source COPY . . # Build the project libraries RUN npm run lib RUN npm run lib:esm FROM node:20-slim WORKDIR /app # Copy built artifacts from builder COPY --from=builder /app/lib /app/lib COPY --from=builder /app/esm /app/esm # Copy package metadata for consumers COPY package.json ./ # Default command: print a friendly message CMD ["sh", "-lc", "echo echarts-for-react build complete. lib/ and esm/ are ready."]
Smoke [FAIL]: test -d /app/lib && test -d /app/esm && echo 'libs exist Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: test -f /app/package.json && echo 'package.json exists Output: sh: 1: Syntax error: Unterminated quoted string Smoke [PASS]: ls -la /app/lib | head -n 5
# Multi-stage build: build library artifacts from source, then prepare a minimal runtime image FROM node:20-slim AS builder WORKDIR /app # Install dependencies COPY package.json ./ RUN npm install --legacy-peer-deps # Copy the rest of the source COPY . . # Build the library artifacts RUN npm run lib RUN npm run lib:esm # Final runtime image FROM node:20-slim WORKDIR /app # Copy built artifacts from builder COPY --from=builder /app/lib /app/lib COPY --from=builder /app/esm /app/esm # Copy entrypoint script COPY entrypoint.sh /usr/local/bin/entrypoint.sh RUN chmod +x /usr/local/bin/entrypoint.sh CMD ["sh", "-lc", "/usr/local/bin/entrypoint.sh"]
#!/bin/sh set -e if [ -d /app/lib ] && [ -d /app/esm ]; then echo "Library artifacts built: lib/ and esm/ are present." else echo "Build artifacts missing." exit 1 fi echo "Ready to use echarts-for-react in consumer projects."
Smoke [PASS]: test -d /app/lib && echo 'lib-dir-ok' || (echo 'lib-dir-missing'; exit 1) Smoke [PASS]: test -d /app/esm && echo 'esm-dir-ok' || (echo 'esm-dir-missing'; exit 1)