[英]client&admin react-scripts: not found
I'm trying to install api-platform with the docker images.我正在尝试使用 docker 图像安装 api-platform。 The problem is that the containers will not start, exiting with code 127.
问题是容器无法启动,以代码 127 退出。
$ react-scripts start
/bin/sh: react-scripts: not found
error Command failed with exit code 127.
I'm using Docker for windows with Linux containers.我正在将 Docker 用于带有 Linux 容器的 Windows。 I tried everything I could think of.
我尝试了我能想到的一切。 The only thing I found in support was rebuilding the client and the admin but to no avail.
我在支持中发现的唯一一件事是重建客户端和管理员,但无济于事。 Anybody an idea?
有人有想法吗?
I use the provided Docker files from the api-plaform: https://github.com/api-platform/api-platform .我使用 api-plaform 提供的 Docker 文件: https : //github.com/api-platform/api-platform 。
Dockerfile admin: # https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage # https://docs.docker.com/compose/compose-file/#target Dockerfile 管理员:# https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage # https://docs.docker.com/compose/compose -文件/#目标
# https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
ARG NODE_VERSION=13
ARG NGINX_VERSION=1.17
# "development" stage
FROM node:${NODE_VERSION}-alpine AS api_platform_admin_development
WORKDIR /usr/src/admin
# prevent the reinstallation of node modules at every changes in the source code
COPY package.json yarn.lock ./
RUN set -eux; \
apk add --no-cache --virtual .gyp \
g++ \
make \
python \
; \
yarn install; \
apk del .gyp
COPY . ./
VOLUME /usr/src/admin/node_modules
ENV HTTPS true
CMD ["yarn", "start"]
# "build" stage
# depends on the "development" stage above
FROM api_platform_admin_development AS api_platform_admin_build
ARG REACT_APP_API_ENTRYPOINT
RUN set -eux; \
yarn build
# "nginx" stage
# depends on the "build" stage above
FROM nginx:${NGINX_VERSION}-alpine AS api_platform_admin_nginx
COPY docker/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
WORKDIR /usr/src/admin/build
COPY --from=api_platform_admin_build /usr/src/admin/build ./
Dockerfile: client # https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage # https://docs.docker.com/compose/compose-file/#target Dockerfile: 客户端 # https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage # https://docs.docker.com/compose/compose -文件/#目标
# https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
ARG NODE_VERSION=13
ARG NGINX_VERSION=1.17
# "development" stage
FROM node:${NODE_VERSION}-alpine AS api_platform_client_development
WORKDIR /usr/src/client
RUN yarn global add @api-platform/client-generator
# prevent the reinstallation of node modules at every changes in the source code
COPY package.json yarn.lock ./
RUN set -eux; \
yarn install
COPY . ./
VOLUME /usr/src/client/node_modules
ENV HTTPS true
CMD ["yarn", "start"]
# "build" stage
# depends on the "development" stage above
FROM api_platform_client_development AS api_platform_client_build
ARG REACT_APP_API_ENTRYPOINT
RUN set -eux; \
yarn build
# "nginx" stage
# depends on the "build" stage above
FROM nginx:${NGINX_VERSION}-alpine AS api_platform_client_nginx
COPY docker/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
WORKDIR /usr/src/client/build
COPY --from=api_platform_client_build /usr/src/client/build ./
I had the same problem.我有同样的问题。 I solved it by directly typing
yarn install
in both directory ( /client
and /admin
).我通过在两个目录(
/client
和/admin
)中直接输入yarn install
解决了这个问题。 You can then start docker
images ( docker-compose up -d
).然后您可以启动
docker
镜像( docker-compose up -d
)。
Hope it helps.希望能帮助到你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.