ডকার এবং এনপিএম - জিপ ইআরআর! ঠিক নাই


10

আমি কিছু সমাধান করার চেষ্টা না করা পর্যন্ত সবকিছুই আমার ক্লায়েন্টের সাথে কাজ করে নেটওয়ার্ক সংযোগ বিচ্ছিন্ন আপগ্রেড দ্বারা বিষয় react-scriptsআমার মধ্যে dockerথেকে ক্লায়েন্ট সেবা 3.0.1করার 3.3.0ব্যবহার npm install <package> --saveএবং এটি আবার নির্মাণ করে।

কিন্তু তারপরে এটি অভিযোগ করা শুরু করে css-loader এবং style-loader, এবং আমি তাদের ইনস্টল করা নেই। তারপরে এটি কার্যকর হয়নি এবং আমি আমার সেটআপটিকে আবার ফিরিয়ে দিয়েছি 3.0.1, --saveএটির থেকেও সরিয়ে দেওয়ার জন্য পতাকা সহ পূর্ববর্তী দুটি প্যাকেজ আনইনস্টল করে node_modules/

এখন, যখন আমি চালাচ্ছি docker-compose -f docker-compose-dev.yml build client ক্লায়েন্ট পরিষেবাটি নির্মিত হলেও আমি নিম্নলিখিত ত্রুটিটি পেয়েছি :

> fsevents@1.2.11 install /usr/src/app/node_modules/chokidar/node_modules/fsevents
> node-gyp rebuild

gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@11.12.0 | linux | x64
gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:158:21)
gyp ERR! System Linux 4.9.184-linuxkit
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/src/app/node_modules/chokidar/node_modules/fsevents
gyp ERR! node -v v11.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 

> core-js@3.6.4 postinstall /usr/src/app/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> fsevents@1.2.11 install /usr/src/app/node_modules/jest-haste-map/node_modules/fsevents
> node-gyp rebuild

gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@11.12.0 | linux | x64
gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:158:21)
gyp ERR! System Linux 4.9.184-linuxkit
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/src/app/node_modules/jest-haste-map/node_modules/fsevents
gyp ERR! node -v v11.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 

এটা আমার ডকার-রচনা-দেব.আইএমএল :

web:
    build:
      context: ./services/web
      dockerfile: Dockerfile-dev
    volumes:
      - './services/web:/usr/src/app'

    ports:
      - 5001:5000
    environment:
      - FLASK_ENV=development
      - APP_SETTINGS=brandio.config.DevelopmentConfig
      - DATABASE_URL=postgres://postgres:postgres@web-db:5432/web_dev 
      - DATABASE_TEST_URL=postgres://postgres:postgres@web-db:5432/web_test
      - SECRET_KEY=my_precious
    depends_on:  
      - web-db
      - redis

client:
    build:
      context: ./services/client
      dockerfile: Dockerfile-dev
    volumes:
      - './services/client:/usr/src/app'
      - '/usr/src/app/node_modules'
    ports:
      - 3000:3000
    environment:
      - NODE_ENV=development
      - REACT_APP_WEB_SERVICE_URL=${REACT_APP_WEB_SERVICE_URL}
    depends_on:
      - web

এই আমার ক্লায়েন্ট ডকফাইফাইল :

# base image
FROM node:11.12.0-alpine

# set working directory
WORKDIR /usr/src/app

# add `/usr/src/app/node_modules/.bin` to $PATH
ENV PATH /usr/src/app/node_modules/.bin:$PATH

# install and cache app dependencies
COPY package.json /usr/src/app/package.json
COPY package-lock.json /usr/src/app/package-lock.json
RUN npm ci
RUN npm install react-scripts@3.3.0 -g --silent

# start app
CMD ["npm", "start"]

ওয়েব পরিষেবা ডকফেরফাইল , যা ক্লায়েন্ট নির্ভর করে। আমি node-gypenv এ ইনস্টল করার চেষ্টা করেছি এবং pythonঅবশ্যই এখানে আছি। কোনও লাভ নেই:

FROM python:3.7-slim-buster

RUN apt-get update && apt-get -y dist-upgrade 
RUN apt-get -y install node-gyp build-essential libssl-dev libffi-dev libblas3 libc6 liblapack3 gcc python3-dev 
RUN apt install -y netcat

# set working directory
WORKDIR /usr/src/app

COPY ./requirements.txt /usr/src/app/requirements.txt 
RUN pip3 install -r requirements.txt

# add entrypoint.sh
COPY ./entrypoint.sh /usr/src/app/entrypoint.sh

RUN chmod +x /usr/src/app/entrypoint.sh

# add app
COPY . /usr/src/app

# run server
CMD ["/usr/src/app/entrypoint.sh"]

Package.json :

    {
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "axios": "^0.18.1",
    "react": "^16.8.6",
    "react-alert": "^5.5.0",
    "react-dom": "^16.8.6",
    "react-hot-loader": "^4.5.3",
    "react-html-parser": "^2.0.2",
    "react-player": "^1.13.0",
    "react-router-dom": "^5.0.0",
    "react-scripts": "^3.3.0",
    "react-transition-group": "^2.9.0",
    "spotify-web-api-js": "^1.2.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "enzyme": "^3.11.0",
    "enzyme-adapter-react-16": "^1.15.2"
  }
}

এখন এটি আবার ফিরে এসেছে 3.3.0, কিন্তু সমস্যা অব্যাহত রয়েছে।


$ npm list পিয়ার নির্ভরতা নিয়ে আমাকে সমস্যাগুলি দেখায়:

npm ERR! peer dep missing: @types/react@^15.0.0 || ^16.0.0, required by react-hot-loader@4.12.18
npm ERR! peer dep missing: typescript@^3.2.1, required by react-scripts@3.3.0
npm ERR! peer dep missing: node-sass@^4.0.0, required by sass-loader@8.0.0
npm ERR! peer dep missing: sass@^1.3.0, required by sass-loader@8.0.0
npm ERR! peer dep missing: fibers@>= 3.1.0, required by sass-loader@8.0.0
npm ERR! peer dep missing: typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta, required by tsutils@3.17.1
npm ERR! peer dep missing: typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta, required by tsutils@3.17.1

বিষয়গুলি সম্পর্কিত কিনা আমি জানি না।


আমিও ইনস্টল করেছি node-gyp বিশ্বব্যাপী , পরীক্ষা করেছি, ত্রুটি অব্যাহত রেখেছি এবং তারপরে আমি আবার আনইনস্টল করেছি।


আমি কিভাবে এটা ঠিক করব?


মনে হচ্ছে কনটেইনারটিতে node:11.12.0-alpineপাইথন বিতরণ নেই
জেনস

1
আমি পাই না। এটি কয়েক মাস ধরে এই সুনির্দিষ্ট সেটআপটি নিয়ে কাজ করেছিল।
8-বিট বোর্জেস

হতে পারে, তবে পাইথন ইনস্টল করে এমন ডকফায়িলিতে আমি কিছুই দেখতে পাচ্ছি না, সুতরাং যদি এটি আগে কাজ করে, তবে এটি এক ধরণের অলৌকিক কাজ। আমি যে সমাধানগুলির সাথে কাজ করি সেগুলিতে দুটি ডকফায়াইল রয়েছে, একটি নোডের জন্য এবং একটি পাইথনের জন্য, একটি ডকার-কম্পোজ.আইএমএল যা উভয়ই লোড করে।
মাইক 'পোম্যাক্স' কামারম্যানস

পাইথন webপরিষেবাতে ইনস্টল করা হয় , যা ক্লায়েন্ট উপর নির্ভর করে। এটা কি বোঝা যায়?
8-বিট বোর্জেস

এটি করে না: কমপক্ষে আপনি কোথায় সেই webকাজটি সংজ্ঞায়িত করেছেন এবং এর মধ্যে কী রয়েছে সে সম্পর্কে অতিরিক্ত তথ্য ছাড়া ।
মাইক 'পোম্যাক্স' কামারম্যানস

উত্তর:


3

আপনার ক্লায়েন্ট ডকফাইফিলের সাথে নিম্নলিখিত লাইনটি যুক্ত করুন:

RUN apk update && apk add python make g++

সুতরাং এটির মতো দেখতে হবে:

# base image
FROM node:11.12.0-alpine

RUN apk update && apk add python make g++

# set working directory
WORKDIR /usr/src/app

# add `/usr/src/app/node_modules/.bin` to $PATH
ENV PATH /usr/src/app/node_modules/.bin:$PATH

# install and cache app dependencies
COPY package.json /usr/src/app/package.json
COPY package-lock.json /usr/src/app/package-lock.json
RUN npm ci
RUN npm install react-scripts@3.3.0 -g --silent

# start app
CMD ["npm", "start"]

আমার ওয়েব চিত্রটি python3.7। এটি python3এখানে যুক্ত করা উচিত নয় ?
8-বিট বোর্জেস

1
প্রস্তাবিত পরিবর্তনটি ক্লায়েন্ট ডকার ফাইলের জন্য যা ওয়েব ডকার ফাইল নয়। নোড-জিপ মডিউলটি পুনর্নির্মাণের জন্য অজগরটির প্রয়োজন। এই অজগরটির আপনার ওয়েব ডকারে অজগরটির কোনও সম্পর্ক নেই।
আবার

আমি আকর্ষণীয় মনে করি যে npm ciআপনার সিআই / সিডিতে কাজ করার জন্য আপনাকে নির্ভরতা হিসাবে অজগর দরকার।
teseo
আমাদের সাইট ব্যবহার করে, আপনি স্বীকার করেছেন যে আপনি আমাদের কুকি নীতি এবং গোপনীয়তা নীতিটি পড়েছেন এবং বুঝতে পেরেছেন ।
Licensed under cc by-sa 3.0 with attribution required.