How can I resolve the "jupyter lab build failed" error on Jupyterhub?

Hello everyone.

The RUN jupyter lab build --dev-build=False --minimize=False --debugpart of the Dockerfile for Jupyterhub fails, so I would like to know how to resolve it.

The versions are as follows.

jupyterhub = "==4.0.2"
jupyterlab = "==4.0.9"
dash = {version = "*", extras = ["jupyter"]}
nodejs = 18 or 20 or...(I'm trying many versions)

*Building is required for @plotly/dash-jupyterlab when using dash with jupyter.

The error that appears is as follows.

276.1 ➤ YN0001: │ RequestError: read ECONNRESET
276.1 at ClientRequest.<anonymous> (/usr/local/lib/python3.10/site-packages/jupyterlab/staging/yarn.js:)
276.1 at Object.onceWrapper (node:events:)
276.1 at ClientRequest.emit (node:events:)
276.1 at o.emit (/usr/local/lib/python3.10/site-packages/jupyterlab/staging/yarn.js:)
276.1 at emitErrorEvent (node:_http_client:)
276.1 at TLSSocket.socketErrorListener (node:_http_client:)
276.1 at TLSSocket.emit (node:events:)
276.1 at emitErrorNT (node:internal/streams/destroy:)
276.1 at emitErrorCloseNT (node:internal/streams/destroy:)
276.1 at process.processTicksAndRejections (node:internal/process/task_queues:)
276.1 at TLSWrap.onStreamRead (node:internal/stream_base_commons:)
276.1[LabBuildApp] npm dependencies failed to install
276.1 [LabBuildApp] ERROR | Build failed.

The build process stops at the following point.

node /usr/local/lib/python3.10/site-packages/jupyterlab/staging/yarn.js install

I would be grateful if you could tell me the solution.

This sounds like a networking problem, e.g. maybe a server is down, or there’s some other issue.

Can you share a link to your full Dockerfile?

Thank you for the information.
Here is the Dockerfile.

FROM python:3.10.12 AS base

ARG project_dir="/***"

ARG proxy="http://***"

WORKDIR ${project_dir}

RUN HTTPS_PROXY=${proxy} python3.10 -m pip install --upgrade pip && \

HTTPS_PROXY=${proxy} python3.10 -m pip install pipenv


FROM base AS develop-base

ENV http_proxy=${proxy}

ENV https_proxy=${proxy}

USER root

RUN apt-get update && apt-get install -y sudo

RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - && \

apt-get install -y nodejs

RUN npm config set proxy ${proxy} && \
    npm config set https-proxy ${proxy} && \
    npm config set strict-ssl false && \
    npm config set registry https://registry.npmjs.org/ && \
    npm cache clean --force && \
    npm install -g yarn && \
    npm install -g configurable-http-proxy

RUN yarn config set network-concurrency 1


FROM develop-base AS jupyter

COPY Pipfile Pipfile.lock setup.py ./

COPY ***/ ./***/

RUN pipenv sync --dev --system

ENV http_proxy=${proxy}

ENV HTTP_PROXY=${proxy}

ENV https_proxy=${proxy}

ENV HTTPS_PROXY=${proxy}

ENV no_proxy=localhost,127.0.0.1

ENV NO_PROXY=localhost,127.0.0.1

ENV NODE_TLS_REJECT_UNAUTHORIZED=0

ENV npm_config_proxy=${proxy}

ENV npm_config_https_proxy=${proxy}

ENV npm_config_strict_ssl=false

ENV npm_config_registry=https://registry.npmjs.org/

RUN npm cache clean --force

RUN yarn cache clean || true

RUN for d in /root /usr/local/share/jupyter/lab /usr/local/share/jupyter/lab/staging; do \

mkdir -p $d && \

echo "proxy ${proxy}" >> $d/.yarnrc && \

echo "https-proxy ${proxy}" >> $d/.yarnrc && \

echo "strict-ssl false" >> $d/.yarnrc && \

echo 'registry "https://registry.npmjs.org/"' >> $d/.yarnrc && \

echo 'network-concurrency 1' >> $d/.yarnrc; \

done

RUN jupyter lab build --dev-build=False --minimize=False --debug

Only the last part, jupyter lab build --dev-build=False --minimize=False --debug ,failed.

*Building is required for @plotly/dash-jupyterlab when using dash with jupyter.

AFAIK this package was deprecated and is not needed with modern versions of dash (v2.11).

I think you will need to setup HTTP Proxy settings for Yarn as well inside the Dockerfile

Thank you for the information.
My dash version is 3.0.4 .
And, according to the web site(Dash in Jupyter Environments | Dash for Python Documentation | Plotly), building @plotly/dash-jupyterlab is required when using dash in jupyterlab.
Do I need to downgrade my dash version?

Oh, right plotly-dash itself did not port to prebuillt/federated :person_facepalming: I commented on [BUG] Dash 2.11 triggers build recommended for @plotly/dash-jupyterlab · Issue #2580 · plotly/dash · GitHub trying to encourage maintainers to pursue this but I am not very optimistic there since previously they just closed the issue.