Problems to build a container

Open
#407 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
docker, node.js

Research direction

Start with the Dockerfile and package*.json, then reproduce the failure with docker build -t apimas .. Inspect the npm install step and the canvas@2.11.2 error output; done means the image builds successfully on the reported Linux ARM environment.

Written by the indexing model from the issue text.

Description

Hey guys,

i cannot solve the error message when i do the command docker build -t apimas .. I received that message and i dont found any solution on github... (The language i'm working is Node.js)

Dockerfile:

# ...
FROM node:14

# ...
WORKDIR /app

# ...
COPY package*.json ./

# ...
RUN npm install

# ...
COPY . .

# ...
EXPOSE 3000

# ...
CMD ["node", "requests.js"]

#...

Error Message:

[+] Building 34.4s (8/9)                                                                                                                                                                                          
 => [internal] load .dockerignore                                                                                                                                                                            0.2s
 => => transferring context: 375B                                                                                                                                                                            0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                         0.3s
 => => transferring dockerfile: 574B                                                                                                                                                                         0.0s
 => [internal] load metadata for docker.io/library/node:14                                                                                                                                                   1.3s
 => [1/5] FROM docker.io/library/node:14@sha256:a158d3b9b4e3fa813fa6c8c590b8f0a860e015ad4e59bbce5744d2f6fd8461aa                                                                                             0.0s
 => [internal] load build context                                                                                                                                                                            0.1s
 => => transferring context: 73.69kB                                                                                                                                                                         0.0s
 => CACHED [2/5] WORKDIR /app                                                                                                                                                                                0.0s
 => [3/5] COPY package*.json ./                                                                                                                                                                              4.2s
 => ERROR [4/5] RUN npm install                                                                                                                                                                             27.9s
------                                                                                                                                                                                                            
 > [4/5] RUN npm install:                                                                                                                                                                                         
#0 2.658 npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@3. I'll try to do my best with it!                            
#0 7.897 npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142                                                                                      
#0 9.389 npm WARN deprecated har-validator@5.1.5: this library is no longer supported                                                                                                                             
#0 9.713 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.
#0 18.91 
#0 18.91 > canvas@2.11.2 install /app/node_modules/canvas
#0 18.91 > node-pre-gyp install --fallback-to-build --update-binary
#0 18.91 
#0 19.95 node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v83-linux-glibc-arm.tar.gz 
#0 19.95 node-pre-gyp WARN Pre-built binaries not installable for canvas@2.11.2 and node@14.21.3 (node-v83 ABI, glibc) (falling back to source compile with node-gyp) 
#0 19.95 node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v83-linux-glibc-arm.tar.gz 
#0 24.41 Package pangocairo was not found in the pkg-config search path.
#0 24.41 Perhaps you should add the directory containing `pangocairo.pc'
#0 24.41 to the PKG_CONFIG_PATH environment variable
#0 24.41 No package 'pangocairo' found
#0 24.41 gyp: Call to 'pkg-config pangocairo --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
#0 24.42 gyp ERR! configure error 
#0 24.43 gyp ERR! stack Error: `gyp` failed with exit code: 1
#0 24.43 gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
#0 24.43 gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
#0 24.43 gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
#0 24.43 gyp ERR! System Linux 6.1.21-v8+
#0 24.43 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" "--update-binary" "--module=/app/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/app/node_modules/canvas/build/Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83"
#0 24.43 gyp ERR! cwd /app/node_modules/canvas
#0 24.43 gyp ERR! node -v v14.21.3
#0 24.43 gyp ERR! node-gyp -v v5.1.1
#0 24.43 gyp ERR! not ok 
#0 24.45 node-pre-gyp ERR! build error 
#0 24.45 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 --update-binary --module=/app/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/app/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
#0 24.45 node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/app/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
#0 24.45 node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
#0 24.45 node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1088:16)
#0 24.45 node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:296:5)
#0 24.45 node-pre-gyp ERR! System Linux 6.1.21-v8+
#0 24.45 node-pre-gyp ERR! command "/usr/local/bin/node" "/app/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
#0 24.45 node-pre-gyp ERR! cwd /app/node_modules/canvas
#0 24.45 node-pre-gyp ERR! node -v v14.21.3
#0 24.45 node-pre-gyp ERR! node-pre-gyp -v v1.0.11
#0 24.45 node-pre-gyp ERR! not ok 
#0 24.45 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 --update-binary --module=/app/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/app/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
#0 24.98 npm WARN app No description
#0 25.02 npm WARN app No repository field.
#0 25.06 npm WARN app No license field.
#0 25.06 
#0 25.45 npm ERR! code ELIFECYCLE
#0 25.45 npm ERR! errno 1
#0 25.48 npm ERR! canvas@2.11.2 install: `node-pre-gyp install --fallback-to-build --update-binary`
#0 25.48 npm ERR! Exit status 1
#0 25.48 npm ERR! 
#0 25.48 npm ERR! Failed at the canvas@2.11.2 install script.
#0 25.48 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
#0 25.56 
#0 25.56 npm ERR! A complete log of this run can be found in:
#0 25.56 npm ERR!     /root/.npm/_logs/2023-08-12T17_05_44_873Z-debug.log
------
Dockerfile:11
--------------------
   9 |     
  10 |     #...
  11 | >>> RUN npm install
  12 |     
  13 |     #...
--------------------
ERROR: failed to solve: process "/bin/sh -c npm install" did not complete successfully: exit code: 1

i found this report but nothing. And then i went to stackoverflow and nothing.

Can you help me?? Thanks!

Dominant language
JavaScript
Stars
3.1k
Forks
6.4k
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from docker/getting-started

All issues in docker/getting-started

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.