jack3898 / discord-youtube-bot-2

A powerful Discord YouTube Bot.
0 stars 0 forks source link

Error on running the bot on m1 macbook #18

Open Jac-Zac opened 2 years ago

Jac-Zac commented 2 years ago

I get the following error when running the command docker-compose up --build --detach. Are you aware of what the problem might be and how I it could be fixed ? I'd be willing to help. Thanks in advance


[+] Building 6.1s (8/8) FINISHED                                                                 
 => [internal] load build definition from Dockerfile                                        0.0s
 => => transferring dockerfile: 181B                                                        0.0s
 => [internal] load .dockerignore                                                           0.0s
 => => transferring context: 167B                                                           0.0s
 => [internal] load metadata for docker.io/library/node:16-alpine                           1.4s
 => [1/4] FROM docker.io/library/node:16-alpine@sha256:c785e617c8d7015190c0d41af52cc69be8a  0.0s
 => [internal] load build context                                                           0.0s
 => => transferring context: 562.38kB                                                       0.0s
 => CACHED [2/4] WORKDIR /home/node                                                         0.0s
 => [3/4] COPY --chown=node:node . .                                                        0.0s
 => ERROR [4/4] RUN npm i                                                                   4.6s
------
 > [4/4] RUN npm i:
#0 4.466 npm notice 
#0 4.466 npm notice New minor version of npm available! 8.11.0 -> 8.13.2
#0 4.466 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.13.2>
#0 4.466 npm notice Run `npm install -g npm@8.13.2` to update!
#0 4.466 npm notice 
#0 4.467 npm ERR! code 1
#0 4.467 npm ERR! path /home/node/node_modules/@discordjs/opus
#0 4.468 npm ERR! command failed
#0 4.468 npm ERR! command sh -c node-pre-gyp install --fallback-to-build
#0 4.468 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=/home/node/node_modules/@discordjs/opus/prebuild/node-v93-napi-v3-linux-arm64-musl-1.2.3/opus.node --module_name=opus --module_path=/home/node/node_modules/@discordjs/opus/prebuild/node-v93-napi-v3-linux-arm64-musl-1.2.3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
#0 4.468 npm ERR! node-pre-gyp info it worked if it ends with ok
#0 4.468 npm ERR! node-pre-gyp info using node-pre-gyp@0.4.2
#0 4.468 npm ERR! node-pre-gyp info using node@16.15.1 | linux | arm64
#0 4.468 npm ERR! node-pre-gyp info check checked for "/home/node/node_modules/@discordjs/opus/prebuild/node-v93-napi-v3-linux-arm64-musl-1.2.3/opus.node" (not found)
#0 4.468 npm ERR! node-pre-gyp http GET https://github.com/discordjs/opus/releases/download/v0.5.3/opus-v0.5.3-node-v93-napi-v3-linux-arm64-musl-1.2.3.tar.gz
#0 4.468 npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/discordjs/opus/releases/download/v0.5.3/opus-v0.5.3-node-v93-napi-v3-linux-arm64-musl-1.2.3.tar.gz 
#0 4.468 npm ERR! node-pre-gyp WARN Pre-built binaries not installable for @discordjs/opus@0.5.3 and node@16.15.1 (node-v93 ABI, musl) (falling back to source compile with node-gyp) 
#0 4.468 npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/discordjs/opus/releases/download/v0.5.3/opus-v0.5.3-node-v93-napi-v3-linux-arm64-musl-1.2.3.tar.gz 
#0 4.468 npm ERR! gyp info it worked if it ends with ok
#0 4.468 npm ERR! gyp info using node-gyp@9.0.0
#0 4.468 npm ERR! gyp info using node@16.15.1 | linux | arm64
#0 4.468 npm ERR! gyp info ok 
#0 4.469 npm ERR! gyp info it worked if it ends with ok
#0 4.469 npm ERR! gyp info using node-gyp@9.0.0
#0 4.469 npm ERR! gyp info using node@16.15.1 | linux | arm64
#0 4.469 npm ERR! gyp ERR! find Python 
#0 4.469 npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
#0 4.469 npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
#0 4.469 npm ERR! gyp ERR! find Python checking if "python3" can be used
#0 4.469 npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
#0 4.469 npm ERR! gyp ERR! find Python checking if "python" can be used
#0 4.469 npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
#0 4.469 npm ERR! gyp ERR! find Python 
#0 4.469 npm ERR! gyp ERR! find Python **********************************************************
#0 4.469 npm ERR! gyp ERR! find Python You need to install the latest version of Python.
#0 4.469 npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
#0 4.469 npm ERR! gyp ERR! find Python you can try one of the following options:
#0 4.469 npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
#0 4.469 npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
#0 4.469 npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
#0 4.469 npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
#0 4.469 npm ERR! gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
#0 4.469 npm ERR! gyp ERR! find Python For more information consult the documentation at:
#0 4.469 npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
#0 4.469 npm ERR! gyp ERR! find Python **********************************************************
#0 4.469 npm ERR! gyp ERR! find Python 
#0 4.469 npm ERR! gyp ERR! configure error 
#0 4.469 npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
#0 4.469 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 4.469 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 4.469 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 4.469 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 4.469 npm ERR! gyp ERR! stack     at exithandler (node:child_process:406:5)
#0 4.469 npm ERR! gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:418:5)
#0 4.469 npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
#0 4.469 npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
#0 4.469 npm ERR! gyp ERR! stack     at onErrorNT (node:internal/child_process:478:16)
#0 4.469 npm ERR! gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
#0 4.469 npm ERR! gyp ERR! System Linux 5.10.104-linuxkit
#0 4.469 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=/home/node/node_modules/@discordjs/opus/prebuild/node-v93-napi-v3-linux-arm64-musl-1.2.3/opus.node" "--module_name=opus" "--module_path=/home/node/node_modules/@discordjs/opus/prebuild/node-v93-napi-v3-linux-arm64-musl-1.2.3" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
#0 4.469 npm ERR! gyp ERR! cwd /home/node/node_modules/@discordjs/opus
#0 4.469 npm ERR! gyp ERR! node -v v16.15.1
#0 4.469 npm ERR! gyp ERR! node-gyp -v v9.0.0
#0 4.469 npm ERR! gyp ERR! not ok 
#0 4.469 npm ERR! node-pre-gyp ERR! build error 
#0 4.469 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=/home/node/node_modules/@discordjs/opus/prebuild/node-v93-napi-v3-linux-arm64-musl-1.2.3/opus.node --module_name=opus --module_path=/home/node/node_modules/@discordjs/opus/prebuild/node-v93-napi-v3-linux-arm64-musl-1.2.3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
#0 4.469 npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/node/node_modules/@discordjs/node-pre-gyp/lib/util/compile.js:85:20)
#0 4.469 npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
#0 4.469 npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1092:16)
#0 4.469 npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
#0 4.469 npm ERR! node-pre-gyp ERR! System Linux 5.10.104-linuxkit
#0 4.469 npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/home/node/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
#0 4.469 npm ERR! node-pre-gyp ERR! cwd /home/node/node_modules/@discordjs/opus
#0 4.469 npm ERR! node-pre-gyp ERR! node -v v16.15.1
#0 4.469 npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.4.2
#0 4.469 npm ERR! node-pre-gyp ERR! not ok
#0 4.471 
#0 4.471 npm ERR! A complete log of this run can be found in:
#0 4.471 npm ERR!     /home/node/.npm/_logs/2022-07-04T12_27_53_309Z-debug-0.log
------
failed to solve: executor failed running [/bin/sh -c npm i]: exit code: 1```
flosrn commented 2 years ago

same here

jhuynh85 commented 2 years ago

Try changing your Dockerfile to this:

FROM node:16-alpine

ENV NODE_ENV production

WORKDIR /home/node

COPY --chown=node:node . .

RUN apk --no-cache --virtual build-dependencies add \
    python3 \
    make \
    g++ \
    && npm i

USER node

CMD ["npm", "run", "bot"];
Jac-Zac commented 2 years ago

I was in the middle of exam session, but now I'm free I have test it and it is fine, thanks.