getting-started icon indicating copy to clipboard operation
getting-started copied to clipboard

Problems to build a container

Open AndreZila01 opened this issue 2 years ago • 0 comments

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 [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142                                                                                      
#0 9.389 npm WARN deprecated [email protected]: this library is no longer supported                                                                                                                             
#0 9.713 npm WARN deprecated [email protected]: 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 > [email protected] 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 [email protected] and [email protected] (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! [email protected] 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 [email protected] 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!

AndreZila01 avatar Aug 12 '23 17:08 AndreZila01