I have one project. And when i try it with "docker-compose up" command on my Windows-PC all is good! Docker do it perfectly without error. But when i try this project on MacOS, i get error on "RUN npm i" step. Why? I get error on the end of error's message - failed to solve: executor failed running [/bin/sh -c npm i]: exit code: 1
Full error log:
> [111-backend builder 4/6] RUN npm i:
#0 4.159 npm WARN deprecated preview-email@3.0.5: Please upgrade to v3.0.7+ as we have added iOS Simulator support to previewing emails! See <https://github.com/forwardemail/preview-email/releases/tag/v3.0.6> and screenshots at <https://github.com/forwardemail/preview-email\#ios-simulator>.
#0 16.18 npm notice
#0 16.18 npm notice New major version of npm available! 8.19.2 -> 9.2.0
#0 16.18 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.2.0>
#0 16.18 npm notice Run `npm install -g npm@9.2.0` to update!
#0 16.18 npm notice
#0 16.18 npm ERR! code 1
#0 16.18 npm ERR! path /app/node_modules/bcrypt
#0 16.18 npm ERR! command failed
#0 16.18 npm ERR! command sh -c -- node-pre-gyp install --fallback-to-build
#0 16.18 npm ERR! Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/app/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
#0 16.18 npm ERR! node-pre-gyp info it worked if it ends with ok
#0 16.18 npm ERR! node-pre-gyp info using node-pre-gyp@1.0.10
#0 16.18 npm ERR! node-pre-gyp info using node@16.18.1 | linux | arm64
#0 16.18 npm ERR! node-pre-gyp info check checked for "/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" (not found)
#0 16.18 npm ERR! node-pre-gyp http GET https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-linux-arm64-musl.tar.gz
#0 16.18 npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-linux-arm64-musl.tar.gz
#0 16.18 npm ERR! node-pre-gyp WARN Pre-built binaries not installable for bcrypt@5.0.1 and node@16.18.1 (node-v93 ABI, musl) (falling back to source compile with node-gyp)
#0 16.18 npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-linux-arm64-musl.tar.gz
#0 16.18 npm ERR! gyp info it worked if it ends with ok
#0 16.18 npm ERR! gyp info using node-gyp@9.1.0
#0 16.18 npm ERR! gyp info using node@16.18.1 | linux | arm64
#0 16.18 npm ERR! gyp info ok
#0 16.18 npm ERR! gyp info it worked if it ends with ok
#0 16.18 npm ERR! gyp info using node-gyp@9.1.0
#0 16.18 npm ERR! gyp info using node@16.18.1 | linux | arm64
#0 16.18 npm ERR! gyp ERR! find Python
#0 16.18 npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
#0 16.18 npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
#0 16.18 npm ERR! gyp ERR! find Python checking if "python3" can be used
#0 16.18 npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
#0 16.18 npm ERR! gyp ERR! find Python checking if "python" can be used
#0 16.18 npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
#0 16.18 npm ERR! gyp ERR! find Python
#0 16.18 npm ERR! gyp ERR! find Python **********************************************************
#0 16.18 npm ERR! gyp ERR! find Python You need to install the latest version of Python.
#0 16.18 npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
#0 16.18 npm ERR! gyp ERR! find Python you can try one of the following options:
#0 16.18 npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
#0 16.18 npm ERR! gyp ERR! find Python (accepted by both node-gyp and npm)
#0 16.18 npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
#0 16.18 npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
#0 16.18 npm ERR! gyp ERR! find Python npm config set python "/path/to/pythonexecutable"
#0 16.18 npm ERR! gyp ERR! find Python For more information consult the documentation at:
#0 16.18 npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
#0 16.18 npm ERR! gyp ERR! find Python **********************************************************
#0 16.18 npm ERR! gyp ERR! find Python
#0 16.18 npm ERR! gyp ERR! configure error
#0 16.18 npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
#0 16.18 npm ERR! gyp ERR! stack at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47)
#0 16.18 npm ERR! gyp ERR! stack at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)
#0 16.18 npm ERR! gyp ERR! stack at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:202:16)
#0 16.18 npm ERR! gyp ERR! stack at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:294:16)
#0 16.18 npm ERR! gyp ERR! stack at exithandler (node:child_process:410:5)
#0 16.18 npm ERR! gyp ERR! stack at ChildProcess.errorhandler (node:child_process:422:5)
#0 16.18 npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
#0 16.18 npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
#0 16.18 npm ERR! gyp ERR! stack at onErrorNT (node:internal/child_process:485:16)
#0 16.18 npm ERR! gyp ERR! stack at processTicksAndRejections (node:internal/process/task_queues:83:21)
#0 16.18 npm ERR! gyp ERR! System Linux 5.15.49-linuxkit
#0 16.18 npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/app/node_modules/bcrypt/lib/binding/napi-v3" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
#0 16.18 npm ERR! gyp ERR! cwd /app/node_modules/bcrypt
#0 16.18 npm ERR! gyp ERR! node -v v16.18.1
#0 16.18 npm ERR! gyp ERR! node-gyp -v v9.1.0
#0 16.18 npm ERR! gyp ERR! not ok
#0 16.18 npm ERR! node-pre-gyp ERR! build error
#0 16.18 npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/app/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
#0 16.18 npm ERR! node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/app/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
#0 16.18 npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:513:28)
#0 16.18 npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1100:16)
#0 16.18 npm ERR! node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
#0 16.18 npm ERR! node-pre-gyp ERR! System Linux 5.15.49-linuxkit
#0 16.18 npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/app/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
#0 16.18 npm ERR! node-pre-gyp ERR! cwd /app/node_modules/bcrypt
#0 16.18 npm ERR! node-pre-gyp ERR! node -v v16.18.1
#0 16.18 npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.10
#0 16.18 npm ERR! node-pre-gyp ERR! not ok
#0 16.19
#0 16.19 npm ERR! A complete log of this run can be found in:
#0 16.19 npm ERR! /root/.npm/_logs/2022-12-08T22_27_57_791Z-debug-0.log
------
failed to solve: executor failed running [/bin/sh -c npm i]: exit code: 1
Backend Dockerfile
FROM node:16-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm i
COPY . .
RUN npm run build
FROM node:16-alpine AS production
WORKDIR /app
COPY --from=builder /app/package*.json ./
RUN npm i --omit=dev
COPY --from=builder /app/ecosystem.config.js ./
COPY --from=builder /app/dist ./dist
RUN npm install pm2 -g
EXPOSE 3000
CMD ["pm2-runtime", "start", "ecosystem.config.js"]
docker-compose.yml
version: "3.2"
services:
database:
container_name: postgres
image: "postgres:12"
networks:
- db
ports:
- "5432:5432"
volumes:
- volume:/var/lib/postgresql/data
env_file: .env
restart: unless-stopped
backend:
container_name: backend
build: ./backend
env_file: .env
restart: "unless-stopped"
ports:
- "4000:3000"
networks:
- network
- db
links:
- database
depends_on:
- database
frontend:
container_name: frontend
build: ./frontend
ports:
- "8081:80"
networks:
- network
restart: "unless-stopped"
volumes:
volume:
driver: local
networks:
db:
driver: bridge
internal: true
network:
driver: bridge