Canvas is not installing through docker on FROM node:lts-alpine3.12

Viewed 327

I am trying run docker file but it throwing error because of canvas npm package. Without canvas it build perfectly. Please have a look on the docker file and errors below

Here is my docker file...

FROM node:lts-alpine3.12

RUN mkdir /srv/app && chown node:node /srv/app

RUN npm install -g @adonisjs/cli

USER node

WORKDIR /srv/app

COPY --chown=node:node package.json package-lock.json ./

RUN npm install --quiet

# TODO: Can remove once we have some dependencies in package.json.
RUN mkdir -p node_modules

COPY . .

RUN cp .env.example .env

USER root

CMD ["npm","start"]

And errors that it returns:

=> ERROR [6/9] RUN npm install --quiet                                                                                                                                  90.6s
------
 > [6/9] RUN npm install --quiet:
#10 7.328 npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
#10 8.013 npm WARN deprecated multicodec@1.0.4: This module has been superseded by the multiformats module
#10 8.052 npm WARN deprecated multibase@0.6.1: This module has been superseded by the multiformats module
#10 9.395 npm WARN deprecated kleur@2.0.2: Please upgrade to kleur@3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github.com/lukeed/kleur/releases/tag/v3.0.0\> for migration path(s).
#10 10.58 npm WARN deprecated har-validator@5.1.5: this library is no longer supported
#10 11.12 npm WARN deprecated formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: 
#10 18.02 npm WARN deprecated @sapphire/snowflake@1.3.6: This version has been automatically deprecated by @favware/npm-deprecate. Please use a newer version.
#10 18.97 npm WARN deprecated cids@0.7.5: This module has been superseded by the multiformats module
#10 21.80 npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
#10 22.80 npm WARN deprecated multibase@1.0.1: This module has been superseded by the multiformats module
#10 22.89 npm WARN deprecated multibase@1.0.1: This module has been superseded by the multiformats module
#10 23.44 npm WARN deprecated multibase@0.7.0: This module has been superseded by the multiformats module
#10 23.53 npm WARN deprecated multibase@0.7.0: This module has been superseded by the multiformats module
#10 23.64 npm WARN deprecated uuid@2.0.1: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
#10 24.08 npm WARN deprecated uuid@3.3.2: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
#10 24.79 npm WARN deprecated discord-api-types@0.18.1: No longer supported. Install the latest release (0.20.2)
#10 29.37 npm WARN deprecated cids@0.8.3: This module has been superseded by the multiformats module
#10 90.53 npm notice 
#10 90.53 npm notice New minor version of npm available! 8.1.2 -> 8.3.0
#10 90.53 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.3.0>
#10 90.53 npm notice Run `npm install -g npm@8.3.0` to update!
#10 90.53 npm notice 
#10 90.53 npm ERR! code 1
#10 90.53 npm ERR! path /srv/app/node_modules/canvas
#10 90.53 npm ERR! command failed
#10 90.53 npm ERR! command sh -c node-pre-gyp install --fallback-to-build
#10 90.53 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=/srv/app/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/srv/app/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
#10 90.53 npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.8.0/canvas-v2.8.0-node-v93-linux-musl-arm64.tar.gz 
#10 90.53 npm ERR! node-pre-gyp WARN Pre-built binaries not installable for canvas@2.8.0 and node@16.13.1 (node-v93 ABI, musl) (falling back to source compile with node-gyp) 
#10 90.53 npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.8.0/canvas-v2.8.0-node-v93-linux-musl-arm64.tar.gz 
#10 90.53 npm ERR! gyp ERR! find Python 
#10 90.53 npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
#10 90.53 npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
#10 90.53 npm ERR! gyp ERR! find Python checking if "python3" can be used
#10 90.53 npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
#10 90.53 npm ERR! gyp ERR! find Python checking if "python" can be used
#10 90.53 npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
#10 90.53 npm ERR! gyp ERR! find Python 
#10 90.53 npm ERR! gyp ERR! find Python **********************************************************
#10 90.53 npm ERR! gyp ERR! find Python You need to install the latest version of Python.
#10 90.53 npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
#10 90.53 npm ERR! gyp ERR! find Python you can try one of the following options:
#10 90.53 npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
#10 90.53 npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
#10 90.53 npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
#10 90.53 npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
#10 90.53 npm ERR! gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
#10 90.53 npm ERR! gyp ERR! find Python For more information consult the documentation at:
#10 90.53 npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
#10 90.53 npm ERR! gyp ERR! find Python **********************************************************
#10 90.53 npm ERR! gyp ERR! find Python 
#10 90.53 npm ERR! gyp ERR! configure error 
#10 90.53 npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
#10 90.53 npm ERR! gyp ERR! stack     at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47)
#10 90.53 npm ERR! gyp ERR! stack     at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)
#10 90.53 npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:202:16)
#10 90.53 npm ERR! gyp ERR! stack     at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:294:16)
#10 90.53 npm ERR! gyp ERR! stack     at exithandler (node:child_process:404:5)
#10 90.53 npm ERR! gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:416:5)
#10 90.53 npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
#10 90.53 npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
#10 90.53 npm ERR! gyp ERR! stack     at onErrorNT (node:internal/child_process:477:16)
#10 90.53 npm ERR! gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
#10 90.53 npm ERR! gyp ERR! System Linux 5.10.47-linuxkit
#10 90.53 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=/srv/app/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/srv/app/node_modules/canvas/build/Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v93"
#10 90.53 npm ERR! gyp ERR! cwd /srv/app/node_modules/canvas
#10 90.53 npm ERR! gyp ERR! node -v v16.13.1
#10 90.53 npm ERR! gyp ERR! node-gyp -v v8.3.0
#10 90.53 npm ERR! gyp ERR! not ok 
#10 90.53 npm ERR! node-pre-gyp ERR! build error 
#10 90.53 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=/srv/app/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/srv/app/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
#10 90.53 npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/srv/app/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
#10 90.53 npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
#10 90.53 npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
#10 90.53 npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
#10 90.53 npm ERR! node-pre-gyp ERR! System Linux 5.10.47-linuxkit
#10 90.53 npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/srv/app/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
#10 90.53 npm ERR! node-pre-gyp ERR! cwd /srv/app/node_modules/canvas
#10 90.53 npm ERR! node-pre-gyp ERR! node -v v16.13.1
#10 90.53 npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.8
#10 90.53 npm ERR! node-pre-gyp ERR! not ok
#10 90.55 

I have tried some other alpine versions but it gave same result. If you need more info please let me know, I will provide

0 Answers
Related