Я относительно новичок с Docker. Когда я пытаюсь запустить свое приложение реагирования (которое отлично работало этим утром), я получаю ошибку, которую не могу понять:
gui_1 | ./node_modules/react-scripts/node_modules/react-dev-utils/webpackHotDevClient.js
gui_1 | Error: [BABEL] /appcode/node_modules/react-scripts/node_modules/react-dev-utils/webpackHotDevClient.js: Cannot find module 'gensync'
gui_1 | Require stack:
gui_1 | - /appcode/node_modules/babel-preset-react-app/node_modules/@babel/preset-env/node_modules/@babel/plugin-transform-destructuring/node_modules/@babel/core/lib/gensync-utils/async.js
gui_1 | - /appcode/node_modules/babel-preset-react-app/node_modules/@babel/preset-env/node_modules/@babel/plugin-transform-destructuring/node_modules/@babel/core/lib/config/caching.js
gui_1 | - /appcode/node_modules/babel-preset-react-app/node_modules/@babel/preset-env/node_modules/@babel/plugin-transform-destructuring/node_modules/@babel/core/lib/config/files/utils.js
gui_1 | - /appcode/node_modules/babel-preset-react-app/node_modules/@babel/preset-env/node_modules/@babel/plugin-transform-destructuring/node_modules/@babel/core/lib/config/files/package.js
gui_1 | - /appcode/node_modules/babel-preset-react-app/node_modules/@babel/preset-env/node_modules/@babel/plugin-transform-destructuring/node_modules/@babel/core/lib/config/files/index.js
gui_1 | - /appcode/node_modules/babel-preset-react-app/node_modules/@babel/preset-env/node_modules/@babel/plugin-transform-destructuring/node_modules/@babel/core/lib/index.js
gui_1 | - /appcode/node_modules/babel-preset-react-app/node_modules/@babel/preset-env/node_modules/@babel/plugin-transform-destructuring/lib/index.js
gui_1 | - /appcode/node_modules/babel-preset-react-app/node_modules/@babel/preset-env/lib/available-plugins.js
gui_1 | - /appcode/node_modules/babel-preset-react-app/node_modules/@babel/preset-env/lib/index.js
gui_1 | - /appcode/node_modules/babel-preset-react-app/dependencies.js
gui_1 | - /appcode/node_modules/react-scripts/node_modules/@babel/core/lib/config/files/plugins.js
gui_1 | - /appcode/node_modules/react-scripts/node_modules/@babel/core/lib/config/files/index.js
gui_1 | - /appcode/node_modules/react-scripts/node_modules/@babel/core/lib/index.js
gui_1 | - /appcode/node_modules/react-scripts/node_modules/babel-loader/lib/index.js
gui_1 | - /appcode/node_modules/loader-runner/lib/loadLoader.js
gui_1 | - /appcode/node_modules/loader-runner/lib/LoaderRunner.js
gui_1 | - /appcode/node_modules/webpack/lib/NormalModule.js
gui_1 | - /appcode/node_modules/webpack/lib/NormalModuleFactory.js
gui_1 | - /appcode/node_modules/webpack/lib/Compiler.js
gui_1 | - /appcode/node_modules/webpack/lib/webpack.js
gui_1 | - /appcode/node_modules/react-scripts/config/webpack.config.js
gui_1 | - /appcode/node_modules/react-app-rewired/scripts/start.js (While processing: "/appcode/node_modules/babel-preset-react-app/dependencies.js")
Зная, что я тренируюсь с docker Я решил удалить все свои изображения этим утром (включая изображение с приложением реагирования на нем). Поэтому я продолжаю пытаться пересобрать и перезапустить его снова, но я всегда получаю эту ошибку, которую не понимаю. Я увидел, что мое ядро - js устарело (core-js@2.6.11), которое используется с библиотекой Ant Design (так внутри моей папки node_modules / babel-runtime).
(ошибка сообщение от docker, при попытке установить все зависимости):
warning antd > babel-runtime > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning antd > rc-tree-select > rc-trigger > rc-animate > fbjs > core-js@1.2.7: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
При запуске моего приложения с CLI (запуск пряжи в консоли) все работает нормально, поэтому я не понимаю, где проблема возникла. Кроме того, я попытался подключиться к своему контейнеру и выполнить npm i
, а затем все снова стало нормально, но я не могу удовлетворить себя плохим решением, подобным этому.
Спасибо за ваши ответы.
ps: это мой Dockerfile
FROM node:latest
COPY package.json /appcode/
RUN set -x; \
cd /appcode; \
yarn install; \
rm package.json yarn.lock;
и мой docker -compose.yml файл:
version: '3.7'
services:
server:
command: sh -c "cd /appcode && ./server.py"
build:
context: ./server
cache_from:
- ifcopenshell
ports:
- '5000:5000'
volumes:
- ./server:/appcode
gui:
command: sh -c "cd /appcode && yarn && yarn start"
build: ./gui
environment:
- CHOKIDAR_USEPOLLING=TRUE
ports:
- '3000:3000'
volumes:
- ./gui:/appcode
- /appcode/node_modules